import 'package:flutter/material.dart';

typedef void OnTapHomeMenu();

class LinearButton extends StatelessWidget {
  final String btntext;
  final OnTapHomeMenu onTapHomeMenu;
  final List<Color> colorList;
  final num btnHeight;
  final Widget childWidget;
  final Color textColor;
  final num textSize;
  final num radius;
  final FontWeight textWeight;
  LinearButton(
      {this.btntext = '',
      this.onTapHomeMenu,
      this.colorList = const [Color(0xFFD4504B), Color(0xFFD4504B)],
      this.btnHeight = 48.0,
      this.childWidget,
      this.textColor = Colors.white,
      this.textSize = 16.0,
      this.radius = 0.0,
      this.textWeight=FontWeight.w600});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: btnHeight,
      decoration: BoxDecoration(
          gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: colorList),
          borderRadius: BorderRadius.all(Radius.circular(radius))),
      child: Material(
        color: Colors.transparent,
        child: InkWell(
          onTap: onTapHomeMenu,
          child: childWidget != null
              ? childWidget
              : Center(
                  child: Text(
                  btntext,
                  style: TextStyle(fontSize: textSize, fontWeight: textWeight, color: textColor),
                )),
        ),
      ),
    );
  }
}
