button - 如何更改颤动材质按钮的字体大小?
问题描述
如何更改材质按钮的字体大小...有更好的方法吗?
new MaterialButton(
height: 140.0,
minWidth: double.infinity,
color: Theme.of(context).primaryColor,
textColor: Colors.white,
child: new Text("material button"),
onPressed: () => {},
splashColor: Colors.redAccent,
),
解决方案
Flutter 中的小部件架构使这变得非常简单: 的孩子MaterialButton
是一个Text
小部件,可以使用其style
属性设置样式:
new MaterialButton(
height: 140.0,
minWidth: double.infinity,
color: Theme.of(context).primaryColor,
textColor: Colors.white,
child: new Text(
"material button",
style: new TextStyle(
fontSize: 20.0,
color: Colors.yellow,
),
),
onPressed: () => {},
splashColor: Colors.redAccent,
);
推荐阅读
- python - pandas 中每台机器的活动计数
- python - 使用 ParameterServerStrategy 时,我们是否需要每个 worker 中的数据集?
- wiremock - Wiremock 请求匹配动态值
- python - 我可以修补一个模块以使用另一个包的不同实现吗?
- r - 计算闪亮范围内的数据百分比
- rust - 是否存在仅在文件存在时才包含文件的 Rust 宏?
- zoho - 更新 zoho 服务台中的工单字段
- c++ - 关于将指向 C++17 标准变体的指针传递给期望 const 引用的函数的不一致行为
- node.js - 在 Sequelize 中自定义偏执狂
- python - 显示来自其他文件的 Matplotlib 图