可容纳一个孩子,为后代的按钮指定默认样式。常用于多个相同按钮的样式统一,避免一一设置。
相关组件
ButtonTheme使用
<br />属性参数同MaterialButton,可以通过ButtonTheme.of获取按钮主题数据,"<br />也可以为ButtonTheme【后代】的按钮组件设置默认样式,包括颜色、形状、尺寸等。<br />![214.gif](https://cdn.nlark.com/yuque/0/2020/gif/326147/1589512135014-4a699b3b-228c-4a63-ab46-649b9193bb93.gif#align=left&display=inline&height=60&margin=%5Bobject%20Object%5D&name=214.gif&originHeight=60&originWidth=262&size=71105&status=done&style=none&width=262)
import 'package:flutter/material.dart';
class ButtonThemeDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ButtonTheme(
buttonColor: Colors.orange,
splashColor: Colors.blue,
minWidth: 40,
shape: CircleBorder(
side: BorderSide(width: 2.0, color: Color(0xFFFFDFDFDF)),
),
child: Wrap(
spacing: 10,
children: <Widget>[
RaisedButton(onPressed: (){},child: Icon(Icons.add)),
FlatButton(onPressed: (){},child: Icon(Icons.add)),
OutlineButton(onPressed: (){},child: Icon(Icons.add)),
MaterialButton(onPressed: (){},child: Icon(Icons.add)),
],
),
);
}
}