如何改变按钮Button的高度?
Botton相关的样式由ButtonTheme进行管理。默认高度是36
如果只是改变某个按钮样式,可以通过外套 ButtonTheme( <---- |
-如果你需要改变默认的ButtonTheme配置,可以在
-如果你需要改变默认的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
进行集成的。