如何改变按钮Button的高度?

Botton相关的样式由ButtonTheme进行管理。默认高度是36

如果只是改变某个按钮样式,可以通过外套​​ButtonTheme​​​进行配置。其实​​MaterialApp​​​内部也是使用​​ButtonTheme​​进行集成的。

ButtonTheme( <----
height: 30,
child: RaisedButton(
child: Text('RaisedButton',),
textColor: Colors.white,
color: Colors.blue,
onPressed: (){
},
),

-如果你需要改变默认的ButtonTheme配置,可以在

#yyds干货盘点#如何改变按钮Button的高度?_sed

-如果你需要改变默认的ButtonTheme配置,可以在MaterialApp#theme#buttonTheme中进行设置.

​MaterialApp#theme#buttonTheme​​中进行设置.


return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
buttonTheme: ButtonTheme.of(context).copyWith(
height: 30, <----
)
),

如果只是改变某个按钮样式,可以通过外套

ButtonTheme( <----
height: 30,
child: RaisedButton(
child: Text('RaisedButton',),
textColor: Colors.white,
color: Colors.blue,
onPressed: (){
},
),

​ButtonTheme​​​进行配置。其实​​MaterialApp​​​内部也是使用​​ButtonTheme​​进行集成的。