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

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

前面介绍的按钮都是继承于 MaterialButton,而 MaterialButton都自带了一些样式,MaterialButton又是继承自RawMaterialButton,RawMaterialButton即无默认样式的按钮
    注意:前面的FlatButton等按钮背景色都是color,RawMaterialButton的背景色是fillColor
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'RawMaterialButton无默认样式的按钮',
        home: Scaffold(
          appBar: AppBar(
            title: Text('RawMaterialButton无默认样式的按钮'),
          ),
          body: RawMaterialButton(
            onPressed: () {},
            child: Text('RawMaterialButton无默认样式的按钮'),
            //文字样式
            textStyle: TextStyle(color: Colors.white),
            //背景色
            fillColor: Colors.orange,
            //高亮时背景色
            highlightColor: Colors.red,
            //阴影
            highlightElevation: 10.0,
            //按下时水波纹颜色
            splashColor: Colors.blue,
            //抗锯齿等级
            clipBehavior: Clip.antiAlias,
            padding: EdgeInsets.all(20.0),
          ),
        ));
  }
}