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
That's because flutter is not about size. It's about constraints.
Usually we have 2 use cases :
Padding
, which takes the child constraint and increases it.SizedBox
, but also Column
in strech mode, ...RaisedButton
is the first case. Which means it's the button which defines its own height/width. And, according to material rules, the raised button size is fixed.
You don't want that behavior, therefore you can use a widget of the second type to override the button constraints.
Anyway, if you need this a lot, consider either creating a new widget which does the job for you. Or use MaterialButton
, which possesses a height property.