
上QQ阅读APP看书,第一时间看更新
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') )