textField divider color

358 views
Skip to first unread message

Michael Tawiah Sowah

unread,
Sep 15, 2017, 7:39:40 PM9/15/17
to Flutter Dev
how do i change the divider color for textfield

Chris Bracken

unread,
Sep 15, 2017, 8:09:57 PM9/15/17
to Michael Tawiah Sowah, Flutter Dev
Hi Michael,

The TL;DR is something like:

new Theme(
  data: Theme.of(context).copyWith(primaryColor: foo, accentColor: bar),
  child: new TextField(...),
)

The line is coming from the InputDecoration associated with the TextField (the 'decoration' property). The InputDecoration provided by the framework uses Colors.black in its inactive state and a computed active color based on your theme's primaryColor (for light themes) or accentColor (for dark themes) when the textfield is focused.

Cheers,
Chris

On Fri, 15 Sep 2017 at 16:39 Michael Tawiah Sowah <michael...@gmail.com> wrote:
how do i change the divider color for textfield

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Tawiah Sowah

unread,
Sep 16, 2017, 1:35:00 AM9/16/17
to Flutter Dev
Hi Chris,
Thanks, but can I change the  inactive state of the line as well?

Chris Bracken

unread,
Sep 16, 2017, 2:16:30 AM9/16/17
to Michael Tawiah Sowah, Flutter Dev
Thanks, but can I change the  inactive state of the line as well?

Yep! What you're after is ThemeData.hintColor.

Michael Tawiah Sowah

unread,
Sep 18, 2017, 10:54:52 AM9/18/17
to Flutter Dev
Chris ThemeData.hintColor. changes the hint text color not the line under the textfield, I want to be able to change that lines color

Collin Jackson

unread,
Sep 18, 2017, 5:11:17 PM9/18/17
to Michael Tawiah Sowah, Flutter Dev
Here is a TextField with a red hintColor and a green primaryColor. Both the labelText and the indicator line are red for the inactive field.




To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.

Michael Tawiah Sowah

unread,
Sep 18, 2017, 5:26:05 PM9/18/17
to Flutter Dev
Thanks Collin, will check why my was not working to see what I did wrong
Reply all
Reply to author
Forward
0 new messages