Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change font size of flutter material button?

How do I change Font size of a material button... is there a better way to do this?

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, ), 
like image 954
IrishGringo Avatar asked Jun 24 '18 19:06

IrishGringo


People also ask

How do you change the font size on a button in flutter?

Flutter – Change Button Font Size Most of the buttons uses Text widget for displaying text in the button. You can change the font size of text in Text widget using style property. As a result, font size of Button text can be changed.

How do I change the size of the material button on flutter?

Raised buttons have a minimum size of 88.0 by 36.0 which can be overridden with ButtonTheme. So you can do it like the following: ButtonTheme( minWidth: 200.0, height: 100.0, child: RaisedButton( onPressed: () {}, child: Text("test"), ), );

How do I resize my text to flutter?

Simply just wrap your Text widget to FittedBox widget like, Here I want to resize my AppBar text based on width. AppBar( centerTitle: true, title: FittedBox( fit: BoxFit. fitWidth, child: Text('Hey this is my long text appbar title') ), ), Text will be resized based on width of AppBar.


1 Answers

The widget architecture in Flutter makes this very simple: The child of the MaterialButton is a Text widget, which can be styled with its style property:

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, ); 
like image 178
boformer Avatar answered Oct 07 '22 06:10

boformer