How can i change the color of underline of a input TextField?

3,159 views
Skip to first unread message

venu gopal Gupta

unread,
Jul 10, 2018, 7:25:10 AM7/10/18
to Flutter Dev
I have tried to define the Input decoration to change the color of underline of input TextField. But it's not working. can anyone suggest what am i missing here ?

Here is the Code snippet :

decoration: InputDecoration(
hintText: 'Username',
hintStyle: TextStyle(color: Colors.white),
border: new UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white,
width: 1.0, style: BorderStyle.none ),
),

Thanks,
Venu Gopal

Hans Muller

unread,
Jul 10, 2018, 10:35:09 AM7/10/18
to vgc...@gmail.com, Flutter Dev
BorderStyle.none means "don't paint the border". The default value for the BorderSide's style property is BorderStyle.solid. That's what you want.


--
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.

venu gopal Gupta

unread,
Jul 10, 2018, 12:25:20 PM7/10/18
to Flutter Dev
i tried to changed the border style to solid. Still i don't see any change.

Hans Muller

unread,
Jul 10, 2018, 12:27:48 PM7/10/18
to vgc...@gmail.com, Flutter Dev
Sorry, I hadn't realized that  there are deeper problems here: https://github.com/flutter/flutter/issues/18751

Please watch the github issue for updates.


--

Podster

unread,
Jul 14, 2018, 12:52:58 AM7/14/18
to Flutter Dev
It's currently a bug. What I did in my app is to wrap the TextField inside a Theme()

```
Theme(
   data: ThemeData(
     hintColor: Colors.blue
  ),
  child: TextField(....)
)
```

I hope this helps.

Sachin Kumar Singh

unread,
Jul 15, 2019, 5:16:38 PM7/15/19
to Flutter Development (flutter-dev)


On Tuesday, July 10, 2018 at 4:55:10 PM UTC+5:30, venu gopal Gupta wrote:
I have tried to define the Input decoration to change the color of underline of input TextField. But it's not working. can anyone suggest what am i missing here ?

Here is the Code snippet :

decoration: InputDecoration(
hintText: 'Username',
hintStyle: TextStyle(color: Colors.white),  
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white,
width: 1.0, style: BorderStyle.none ),
),focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color:Colors.white))
The above changes I made works fine. You can now use it.
Thanks,
Venu Gopal
Reply all
Reply to author
Forward
0 new messages