你如何改变 TextButton flutter 上的字体大小
How do you change the font size on a TextButton flutter
这里你会改变这个例子中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),),
)
SizedBox(
height:100,
width:100,
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', style: TextStyle( fontSize: 30),
)
)
这里你会改变这个例子中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),),
)
SizedBox(
height:100,
width:100,
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', style: TextStyle( fontSize: 30),
) )