I am looking to remove the default margin of the FlatButton but can't seem to set/override it.
Column(children: <Widget>[ Container( children: [ FractionallySizedBox( widthFactor: 0.6, child: FlatButton( color: Color(0xFF00A0BE), textColor: Color(0xFFFFFFFF), child: Text('LOGIN', style: TextStyle(letterSpacing: 4.0)), shape: RoundedRectangleBorder(side: BorderSide.none)))), Container( margin: const EdgeInsets.only(top: 0.0), child: FractionallySizedBox( widthFactor: 0.6, child: FlatButton( color: Color(0xFF00A0BE), textColor: Color(0xFF525252), child: Text('SIGN UP', style: TextStyle( fontFamily: 'Lato', fontSize: 12.0, color: Color(0xFF525252), letterSpacing: 2.0))))) ])
I've come across things like ButtonTheme
and even debugDumpRenderTree()
but haven't been able to implement them properly.
For all those who are wondering on how to remove the default padding around the text of a FlatButton , you can make use of RawMaterialButton instead and set the constraints to BoxConstraints() which will reset the default minimum width and height of button to zero.
In Flutter, you can provide padding property to Button widget. To provide padding to Button, assign the padding property with EdgeInsets object. The following code snippet applies padding of 30 to all the four sides of the button. padding: EdgeInsets.
FlatButton(materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With