首页 > 建站教程 > APP开发,混合APP >  Flutter笔记15:RawMaterialButton无默认样式的按钮正文

Flutter笔记15:RawMaterialButton无默认样式的按钮

前面介绍的按钮都是继承于 MaterialButton,而 MaterialButton都自带了一些样式,MaterialButton又是继承自RawMaterialButton,RawMaterialButton即无默认样式的按钮
    注意:前面的FlatButton等按钮背景色都是color,RawMaterialButton的背景色是fillColor
01class MyApp extends StatelessWidget {
02  @override
03  Widget build(BuildContext context) {
04    return MaterialApp(
05        title: 'RawMaterialButton无默认样式的按钮',
06        home: Scaffold(
07          appBar: AppBar(
08            title: Text('RawMaterialButton无默认样式的按钮'),
09          ),
10          body: RawMaterialButton(
11            onPressed: () {},
12            child: Text('RawMaterialButton无默认样式的按钮'),
13            //文字样式
14            textStyle: TextStyle(color: Colors.white),
15            //背景色
16            fillColor: Colors.orange,
17            //高亮时背景色
18            highlightColor: Colors.red,
19            //阴影
20            highlightElevation: 10.0,
21            //按下时水波纹颜色
22            splashColor: Colors.blue,
23            //抗锯齿等级
24            clipBehavior: Clip.antiAlias,
25            padding: EdgeInsets.all(20.0),
26          ),
27        ));
28  }
29}