как изменить размер шрифта кнопки флаттера?
Как изменить размер шрифта кнопки материала... есть ли лучший способ сделать это?
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,
),
Ответы
Ответ 1
Архитектура виджета в Flutter делает это очень простым: дочерний элемент MaterialButton
- это Text
виджет, который можно стилизовать со свойством style
:
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,
);
Ответ 2
Вы можете использовать style
атрибута вашего Text
виджета.
MaterialButton(
...
child: Text(
'material button',
style: TextStyle(
fontSize: 20.0, // insert your font size here
),
),
)