- Flutter实战入门
- 老孟
- 134字
- 2020-08-27 06:10:09
3.1.4 按钮组件(Button)
常用的按钮组件有3个:RaisedButton、FlatButton、OutlineButton,这3个按钮的说明参见表3-6。
表3-6 按钮组件

默认的效果如图3-11所示。

图3-11 按钮组件
按钮组件常用的属性参见表3-7。
表3-7 按钮组件属性

按钮组件基础用法如下:
RaisedButton( onPressed: (){print('onPressed');}, child: Text('RaisedButton'), ), FlatButton( onPressed: () {}, child: Text('FlatButton'), ), OutlineButton( onPressed: () {}, child: Text('OutlineButton'), ),
带图标的按钮写法如下:
RaisedButton.icon( onPressed: () {}, icon: Icon(Icons.access_alarm), label: Text('label') )