import 'package:flutter/material.dart';
import 'package:liftmanager/res/resources.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,
    this.backColor = Colours.blue_app_main
  }) : super(key: key);

  final String text;
  final VoidCallback onPressed;
  final List<Color> colors;
  final Color textColor;
  final Color borderColor;
  final Color backColor;
  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:backColor,
                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,
                )),
          ),
        ],
      ),
    );
  }
}
