import 'package:farm_tpf/utils/const_color.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; class ButtonIconWidget extends StatelessWidget { final String title; final TextStyle titleStyle; final String subTitle; final Function onTap; final String leadingIcon; final String trailingIcon; final bool isTopBorder; final bool isBottomBorder; ButtonIconWidget( {@required this.title, @required this.onTap, this.titleStyle, this.subTitle, this.leadingIcon, this.trailingIcon, this.isBottomBorder = true, this.isTopBorder = true}); @override Widget build(BuildContext context) { return SizedBox( width: double.infinity, child: MaterialButton( padding: EdgeInsets.all(0), onPressed: onTap, child: Container( padding: EdgeInsets.all(12), decoration: BoxDecoration( border: Border( top: isTopBorder ? BorderSide(color: AppColors.GRAY1, width: 0.35) : BorderSide.none, bottom: isBottomBorder ? BorderSide(color: AppColors.GRAY1, width: 0.35) : BorderSide.none)), width: double.infinity, child: Row( mainAxisSize: MainAxisSize.max, children: [ leadingIcon == null ? SizedBox() : SizedBox( width: 20, height: 20, child: SvgPicture.asset(leadingIcon)), SizedBox(width: 4), Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ Text( title, style: titleStyle ?? TextStyle(fontSize: 16, fontWeight: FontWeight.w100), ), subTitle == null ? SizedBox() : Text( subTitle, style: TextStyle(fontSize: 14), ) ], ), ), trailingIcon == null ? SizedBox() : SvgPicture.asset(trailingIcon) ], ), ), ), ); } }