batuhankrbb
batuhankrbb

Reputation: 706

How to change font size of textfield in Flutter?

I have a textfield and I want to change the font size of it because my application will be available for both iPad and mobile phones. The font size of the textfield is good for mobile phones but too small for iPad. How can I change it?

Upvotes: 7

Views: 19941

Answers (3)

Avnish Nishad
Avnish Nishad

Reputation: 1862

Use style under TextField

TextField(
 style:TextStyle(fontSize:10),

 //want to change the style for label and hint then
 
 decoration:InputDecoration(
   labelStyle:TextStyle(fontSize:10),
   hintStyle: TextStyle(fontSize:10),
 )
)

Upvotes: 8

Code on the Rocks
Code on the Rocks

Reputation: 17824

You can use the style property:

                   Text(
                      'Bronze Master',
                      style: TextStyle(
                        fontSize: 8,
                        color: Colors.blue.shade700,
                        fontWeight: FontWeight.w600,
                      ),
                    ),

You should note that this font size is relative and the actual font size you see on your device will be based on the device's font size settings. This is also a really good way to figure out where you have overflow issue.

  1. Go to you device's settings
  2. Increase the font size to Large
  3. Open your Flutter app in debug mode and find the overflows

Upvotes: 9

batuhankrbb
batuhankrbb

Reputation: 706

I found it. The font size of the TextField can be changed through its style property

Upvotes: 4

Related Questions