How to set the width of a RaisedButton in Flutter?

后端 未结 20 1904
傲寒
傲寒 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:30

    If you want globally change the height and the minWidth of all your RaisedButtons, then you can override ThemeData inside your MaterialApp:

     @override
      Widget build(BuildContext context) {
        return MaterialApp(
           ...
           theme: ThemeData(
           ...
           buttonTheme: ButtonThemeData(
              height: 46,
              minWidth: 100,
           ),
        ));
      }
    

提交回复
热议问题