Flutter(十一)基础控件-Button
2021-12-21 本文已影响0人
学_iOS
感君一回顾,思君朝与暮。
<一> Flutter中的Button有ElevatedButton、TextButton、OutlinedButton、IconButton等
- 代码
class ButtonDemo extends StatelessWidget { @override Widget build(BuildContext context) { return Column( children: [ ElevatedButton( onPressed: () { print('点击事件'); }, child: Text('漂浮按钮'), ), TextButton( onPressed: () { print('点击事件'); }, child: Text("漂浮按钮"), ), TextButton.icon( label: Text("data"), onPressed: () { print('点击事件'); }, icon: Icon(Icons.add), style: TextButton.styleFrom(backgroundColor: Colors.red) ), OutlinedButton(onPressed: () {}, child: Text("OutlinedButton")), IconButton(onPressed: () {}, icon: Icon(Icons.home)) ], ); } }