0

textScaleFactor : -

textScaleFactor: 1.0

How to use TextFormField in flutter to fix text size for all type of resolution ?

Ramji
  • 904
  • 2
  • 5
  • 20
Vrusti Patel
  • 394
  • 2
  • 15
  • I think you are looking for this answer: https://stackoverflow.com/a/66668724/1318946 – Pratik Butani Jan 04 '23 at 07:04
  • No. For that I have pass context in my entire project and also have to use material app. I have taken common widget and used in 206 screens. So I cant do that – Vrusti Patel Jan 04 '23 at 07:10
  • In Text widget we simply pass textScaleFactor: 1.0 property to restrict size. In a same way can we use that in text form field ? or any other way ? – Vrusti Patel Jan 04 '23 at 07:11
  • You have to post the custom widget that you have created. – Pratik Butani Jan 04 '23 at 07:14
  • Does this answer your question? [TextScaleFactor for TextField in Flutter?](https://stackoverflow.com/questions/54581400/textscalefactor-for-textfield-in-flutter) – Pratik Butani Jan 04 '23 at 08:53
  • Yes. Kind of that. But in that I have to pass context to use. Actually I have made global widget to use in entire project. So, I just pass constant mediaquery to use it. And It is working fine. But Thanks a lot... – Vrusti Patel Jan 04 '23 at 10:29

1 Answers1

1

Wrap your TextFormField with MediaQuery like so.

MediaQuery(
    data: const MediaQueryData(textScaleFactor: 2.0),
    child: TextFormField(),
),
Anas
  • 1,013
  • 1
  • 6
  • 20