Reputation: 1580
How to change TextFormField
's textScaleFactor
like on text widget below?
Text(
'...',
textScaleFactor: 1,
),
Upvotes: 1
Views: 1833
Reputation: 1580
I have found the way :)
final double scaleFactor = MediaQuery.of(context).textScaleFactor;
TextFormField(
style: TextStyle(
fontSize: 16 / scaleFactor,
),
),
There is also a sort of shortcut for this: MediaQuery.textScaleFactorOf(context)
.
You could also do something like changing the MediaQuery
subcontext for the widget itself:
MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: 2 * MediaQuery.textScaleFactorOf(context),
),
child: TextFormField(...),
),
Upvotes: 3