01 | class MyApp extends StatelessWidget { |
02 | @override |
03 | Widget build(BuildContext context) { |
04 | return MaterialApp( |
05 | title: 'IconButton图标按钮' , |
06 | home: Scaffold( |
07 | appBar: AppBar( |
08 | title: Text( 'IconButton图标按钮' ), |
09 | ), |
10 | body: Center( |
11 | child: Container( |
12 | decoration: BoxDecoration(color: Colors.grey), |
13 | width: 200.0, |
14 | height: 200.0, |
15 | child: IconButton( |
16 | //位置(根据父容器决定自己的位置) |
17 | alignment: AlignmentDirectional.centerStart, |
18 | //颜色 |
19 | color: Colors.green, |
20 | //大小 |
21 | iconSize: 48.0, |
22 | padding: EdgeInsets.all(30), |
23 | //水波纹颜色 |
24 | splashColor: Colors.blue, |
25 | tooltip: '图标按钮' , |
26 | //图标 |
27 | icon: Icon(Icons.print), |
28 | //点击事件 |
29 | onPressed: () {}), |
30 | ) |
31 | ), |
32 | ) |
33 | ); |
34 | } |
35 | } |
部分素材资源来源网站,本站提供免费下载,如有侵权请联系站长马上删除!