import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:flutter/material.dart'; class BorderedButton extends StatelessWidget { final String? text; final Function? handler; final Color? textColor; final bool hasBorder; final Color? borderColor; final Color? backgroundColor; final double vPadding; final double hPadding; final double radius; final double lPadding; final double tPadding; final double rPadding; final double bPadding; final double fontSize; final Widget? icon; final FontWeight? fontWeight; final bool hasShadow; BorderedButton( this.text, { this.handler, this.textColor, this.hasBorder = false, this.borderColor, this.backgroundColor, this.vPadding = 0, this.hPadding = 0, this.radius = 4.0, this.lPadding = 4.0, this.tPadding = 0.0, this.rPadding = 4.0, this.bPadding = 0.0, this.fontSize = 0, this.icon, this.fontWeight, this.hasShadow = false, }); @override Widget build(BuildContext context) { return GestureDetector( onTap: () { handler!(); }, child: Container( decoration: BoxDecoration( shape: BoxShape.rectangle, color: backgroundColor ?? Colors.white, borderRadius: BorderRadius.circular(radius), border: Border.fromBorderSide(BorderSide( color: hasBorder! ? borderColor! : Colors.white, width: 0.8, )), boxShadow: [ BoxShadow( color: !hasShadow ? Colors.transparent : Colors.grey.withOpacity(0.5), // spreadRadius: 5, blurRadius: 15.0, offset: Offset(0.0, 0.75) // changes position of shadow ), ]), child: Container( child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ icon != null ? icon! : Container(), Container( padding: (hPadding > 0 || vPadding > 0) ? EdgeInsets.symmetric( vertical: vPadding, horizontal: hPadding) : EdgeInsets.fromLTRB( lPadding, tPadding, rPadding, bPadding), child: Text( text!, textAlign: TextAlign.center, style: TextStyle( fontSize: fontSize == 0 ? SizeConfig.textMultiplier! * 1.6 : fontSize, fontWeight: fontWeight != null ? fontWeight : FontWeight.normal, color: textColor ?? Color(0xffc4aa54)), ), ), ], ), ), ), ); } }