Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raised button width decrease flutter

Raised button taking too much width and I want to decrease according to my layout...

ButtonTheme(
    minWidth: 16.0,
    height: 30.0,
    child: RaisedButton(
     onPressed:()=>print("a"),
     child: new Row(
       children: <Widget>[
         Padding(
           padding: const EdgeInsets.only(right: 6.0),
           child: Text('SORT BY',style: TextStyle(fontSize: 12.0),),
         ),
         Icon(Icons.keyboard_arrow_down,size: 20.0,),
       ],
     ),
    ),
),
like image 516
Rahul Mishra Avatar asked Aug 06 '26 15:08

Rahul Mishra


1 Answers

I got the answer

We need to add padding in Raised button for removing default padding

ButtonTheme(
      minWidth: 16.0,
      height: 30.0,
      child: RaisedButton(
        padding: const EdgeInsets.all(8.0),
        onPressed: () => print("a"),
        child: new Row(
          children: <Widget>[
            Padding(
              padding: const EdgeInsets.only(right: 6.0),
              child: Icon(
                Icons.filter,
                size: 16.0,
              ),
            ),
            Text(
              'FILTER',
              style: TextStyle(fontSize: 12.0),
            ),
          ],
        ),
      ),
    ),
like image 143
Rahul Mishra Avatar answered Aug 08 '26 04:08

Rahul Mishra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!