12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import 'package:flutter/material.dart';
- import 'package:liftmanager/res/resources.dart';
- import 'package:liftmanager/utils/theme_utils.dart';
- class MyButton extends StatelessWidget {
- const MyButton({
- Key key,
- this.text: "",
- this.textColor,
- this.borderColor,
- this.borderWidth = 0,
- @required this.onPressed,
- this.colors,
- this.height = 44,
- this.fontSize = Dimens.font_sp18,
- }) : super(key: key);
- final String text;
- final VoidCallback onPressed;
- final List<Color> colors;
- final Color textColor;
- final Color borderColor;
- final double borderWidth;
- final double height;
- final double fontSize;
- @override
- Widget build(BuildContext context) {
- // bool isDark = ThemeUtils.isDark(context);
- return FlatButton(
- onPressed: onPressed,
- child: Column(
- children: <Widget>[
- Container(
- height: this.height,
- // width: double.infinity,
- padding: EdgeInsets.only(left: 10, right: 10),
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(this.height / 2),
- gradient: LinearGradient(
- colors:
- this.colors ?? [Color(0xFF00D4FF), Color(0xFF007CFF)]),
- border: Border.all(
- color: this.borderColor ?? Colors.transparent,
- width: this.borderWidth)),
- child: Text(text,
- style: TextStyle(
- fontSize: this.fontSize,
- color: this.textColor ?? Colors.white,
- )),
- ),
- ],
- ),
- );
- }
- }
|