How to set the width of a RaisedButton in Flutter?

后端 未结 20 1882
傲寒
傲寒 2021-01-30 06:01

I have seen that I can\'t set the width of a RaisedButton in Flutter. If I have well understood, I should put the RaisedButton into a SizedBox

相关标签:
20条回答
  • 2021-01-30 06:46

    Try it out

    Expanded(   
      child: RaisedButton(
        onPressed: _onButtonPressed,
        child: Text('Button1')
      )  
    )
    
    0 讨论(0)
  • 2021-01-30 06:48

    In my case I used margin to be able to change the size:

    Container(
    
    
         margin: EdgeInsets.all(10),
    
        // or margin: EdgeInsets.only(left:10, right:10),
    
    
    
            child: RaisedButton(
              padding: EdgeInsets.all(10),
    
              shape: RoundedRectangleBorder(borderRadius: 
    BorderRadius.circular(20)),
              onPressed: () {},
              child: Text("Button"),
            ),
          ),
    
    0 讨论(0)
提交回复
热议问题