【发布时间】:2021-06-15 20:13:09
【问题描述】:
你会在这个例子中改变 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'),
【问题讨论】:
-
"fontSize" 在 Text() 小部件中使用 Text(style: TextStyle(fontSize: 25))
标签: flutter flutter-layout font-size