I am working in the styles of my app, i am not able to change the color of the input of the TextField
, there isn't any property to change it.
Theme( data: new ThemeData( hintColor: Colors.white ), child: TextField( focusNode: _focusUsername, controller: _controller, decoration: InputDecoration( border: InputBorder.none, fillColor: Colors.grey, filled: true, hintText: 'Username', ))),
You are changing input text color in this line TextStyle(fontSize: 20.0, color: textTheme. button. color) , so in order to set in to white just use Colors. white constant instead of textTheme.
Step 2: Inside the TextField widget, add the decoration parameter and assign the InputDecoration widget. Step 3: Inside the InputDecoration widget, add the hintStyle parameter and assign the TextStyle widget. Step 4: Inside the TextStyle , add color parameter and set the color of your choice.
You can change the TextField underline color globally by defining the inputDecorationTheme and then adding the UnderlineInputBorder widget. Inside the UnderlineInputBorder widget, you can specify which type of border you want to change. for example, enabledBorder , focusedBorder , and so on, and then assign the color.
Steps. Step 1: Locate the file where you have placed the Text widget. Step 2: Inside the Text widget, add the Style parameter and assign the TextStyle widget. Step 3: Inside the TextStyle widget, add the color parameter and set the color of your choice.
You can assign a TextStyle
TextField( style: TextStyle(color: Colors.white), ... )
https://docs.flutter.io/flutter/painting/TextStyle-class.html
In the example bellow, text is 'red' and the background of the TextField is 'orange'.
TextField( style: TextStyle(color: Colors.red), decoration: InputDecoration(fillColor: Colors.orange, filled: true), )
Is that what you mean?
If you want to do it generically through the app's theme, it's indeed tricky. It's probably going to be something like that:
theme: ThemeData( textTheme: TextTheme( bodyText1: TextStyle(color: Colors.black), bodyText2: TextStyle(color: Colors.black), button: TextStyle(color: Colors.black), caption: TextStyle(color: Colors.black), subtitle1: TextStyle(color: Colors.red), // <-- that's the one headline1: TextStyle(color: Colors.black), headline2: TextStyle(color: Colors.black), headline3: TextStyle(color: Colors.black), headline4: TextStyle(color: Colors.black), headline5: TextStyle(color: Colors.black), headline6: TextStyle(color: Colors.black), ), inputDecorationTheme: InputDecorationTheme( fillColor: Colors.orange, filled: true, ) )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With