import 'package:flutter/material.dart'; extension WithContainer on Widget { Widget get insideContainer => Container(color: Colors.white, padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: this); } class DefaultButton extends StatelessWidget { final String text; final VoidCallback onPress; final Color textColor; final Color color; final Color disabledColor; final IconData iconData; final double fontSize; DefaultButton(this.text, this.onPress, {this.color, this.disabledColor, this.textColor = Colors.white, this.iconData, this.fontSize}); @override Widget build(BuildContext context) { return SizedBox( height: 43, width: double.infinity, child: FlatButton( onPressed: onPress, child: Row( children: [ if (iconData != null) Icon(iconData, color: textColor), Expanded( child: Text( text, textAlign: TextAlign.center, style: TextStyle(fontSize: fontSize ?? 16, fontWeight: FontWeight.w600, color: textColor, letterSpacing: -0.48), ), ), ], ), // color: Color(0xffD02127), color: color ?? const Color(0xffD02127), disabledColor: disabledColor, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(6), ), ), ); } }