How do you change the font size on a TextButton flutter
1,238
Please try out
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),),
)
Author by
ukholly
Updated on December 30, 2022Comments
-
ukholly over 1 year
here would you change the font size of Hello World in this example? Tried the font style etc but gets errors, what am I missing pls?
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'),
-
Naveen Avidi almost 3 years"fontSize" in Text() widget using Text(style: TextStyle(fontSize: 25))
-
-
ukholly almost 3 yearsThanks all! So simple when you know how!