flutter - 如何更改 TextButton 颤动的字体大小
问题描述
在这个例子中你会改变 Hello World 的字体大小吗?尝试了字体样式等但出现错误,请问我错过了什么?
new TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(Colors.white.withOpacity(0.7)),
overlayColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.focused) ||
states.contains(MaterialState.pressed))
return Colors.red.withOpacity(0.7);
return Colors.red;
return Colors.white70; // Defer to the widget's default.
}
),
),
child: new Text('Hello World'),
解决方案
请试用
TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(
Colors.white.withOpacity(0.7)),
overlayColor: MaterialStateProperty.resolveWith<Color>(
(Set<MaterialState> states) {
if (states.contains(MaterialState.focused) ||
states.contains(MaterialState.pressed))
return Colors.red.withOpacity(0.7);
return Colors.red; // Defer to the widget's default.
return Colors.white70;
}),
),
child: new Text('Hello World', style: TextStyle( fontSize: 30),),
)
推荐阅读
- haskell - 在 Haskell 中为可变参数模式使用类型类
- java - 我该如何解决这个问题:线程“主”org.springframework.beans.factory.BeanDefinitionStoreException中的异常:
- javascript - angularjs + bootstrap,模板函数中的btn
- javascript - 如何将数据从服务器(node.js)分块发送到客户端(react.js)?
- java - Jdeveloper 11.1.1.4.0 11c 的 Git 扩展
- python - 使用来自两个单独的 pandas 数据帧的列绘制多个重叠直方图
- javascript - 当单击模式菜单外部关闭功能处于活动状态时,模式菜单链接不起作用
- javascript - 从承诺结果运行逻辑
- python - 使用 pynput 时无法将字符串转换为元组
- python - kivy中的简单动画