感君一回顾,思君朝与暮。
<一> 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)) ], ); } }
网友评论