button159 function

dynamic button159(
  1. String text,
  2. List<Color> gradient,
  3. IconData icon,
  4. Function _callback, {
  5. bool enable = true,
  6. double? radius,
  7. TextStyle? style,
  8. double iconSize = 20,
  9. String? text2,
  10. TextStyle? style2,
  11. Color borderColor = Colors.transparent,
  12. Color iconColor = Colors.white,
})

Implementation

button159(String text, List<Color> gradient, IconData icon, Function _callback,
    {bool enable = true, double? radius, TextStyle? style, double iconSize = 20,
      String? text2, TextStyle? style2, Color borderColor = Colors.transparent,
      Color iconColor = Colors.white}){
  return Stack(
    children: <Widget>[

      Container(
          padding: EdgeInsets.all(20),
          decoration: BoxDecoration(
              border: Border.all(color: borderColor),
              borderRadius: BorderRadius.all(Radius.circular(radius ?? aTheme.radius)),
              gradient: (enable) ?  LinearGradient(
                begin: Alignment.topRight,
                end: Alignment.bottomLeft,
                colors: gradient,
              ) : LinearGradient(
                begin: Alignment.topRight,
                end: Alignment.bottomLeft,
                colors: [Colors.grey.withOpacity(0.5), Colors.grey.withOpacity(0.5)],
              )
          ),
          child: Row(
            children: [
              Expanded(child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(text, style: style ?? aTheme.style16W800White, textAlign: TextAlign.start,),
                  SizedBox(height: 10,),
                  if (text2 != null)
                    Text(text2, style: style2 ?? aTheme.style16W800White, textAlign: TextAlign.start,)
                ],
              )),
              Icon(icon, color: iconColor, size: iconSize, ),
            ],
          )
      ),
      if (enable)
        Positioned.fill(
          child: Material(
              color: Colors.transparent,
              clipBehavior: Clip.hardEdge,
              shape: RoundedRectangleBorder(borderRadius:BorderRadius.circular(radius ?? aTheme.radius)),
              child: InkWell(
                splashColor: Colors.black.withOpacity(0.2),
                onTap: (){
                  _callback();
                }, // needed
              )),
        )

    ],
  );
}