Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove padding in Flutter Container > FlatButton

Tags:

flutter

I am looking to remove the default margin of the FlatButton but can't seem to set/override it.

buttons with padding

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.

like image 677
Don Boots Avatar asked Oct 03 '18 13:10

Don Boots


People also ask

How do you remove padding from a FlatButton Flutter?

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.

How do you change the button padding on a Flutter?

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.


1 Answers

FlatButton(materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,) 
like image 198
Andrey Turkovsky Avatar answered Sep 17 '22 01:09

Andrey Turkovsky