![Flutter实战入门](https://wfqqreader-1252317822.image.myqcloud.com/cover/55/32436055/b_32436055.jpg)
上QQ阅读APP看书,第一时间看更新
3.1.4 按钮组件(Button)
常用的按钮组件有3个:RaisedButton、FlatButton、OutlineButton,这3个按钮的说明参见表3-6。
表3-6 按钮组件
![](https://epubservercos.yuewen.com/E5359F/17517093106688906/epubprivate/OEBPS/Images/b3-6-i.jpg?sign=1739278567-dtwE3MPIduS9ugDe5dOYvcPR9ldOyB1T-0-91f10ffd05547c6609809c5b9aeae33b)
默认的效果如图3-11所示。
![](https://epubservercos.yuewen.com/E5359F/17517093106688906/epubprivate/OEBPS/Images/t3-11-i.jpg?sign=1739278567-YpBtJzsu6QldAcf0QdMMxnlPmg3O7TAs-0-98718e1271993d9e57b8c17021931e62)
图3-11 按钮组件
按钮组件常用的属性参见表3-7。
表3-7 按钮组件属性
![](https://epubservercos.yuewen.com/E5359F/17517093106688906/epubprivate/OEBPS/Images/b3-7-i.jpg?sign=1739278567-zvReph3aC4oQoTD7fmi5lSR22T31U8AP-0-cd21d4bf88b9949805e48ba540bfd5e3)
按钮组件基础用法如下:
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') )