Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get default theme for TextFormField's InputDecoration's label

Tags:

flutter

I need to create a custom widget that sits alongside of TextFormFields, so I have to style its label to match TextFormField's label style.

This does NOT work:

Theme.of(ctx).inputDecorationTheme.labelStyle

Because, according to its doc:

If null, defaults to a value derived from the base [TextStyle] for the input field and the current [Theme].

The problem is, I don't know how to get that base style.

like image 844
wiradikusuma Avatar asked Apr 15 '19 10:04

wiradikusuma


1 Answers

You are getting the base style correctly. In my case labelStyle and hintStyle from InputDecorationTheme can not be updated by hot reload, but they work when rerunning the app.

like image 98
Iulia P Avatar answered Oct 20 '22 13:10

Iulia P