Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To change the UnderlineInputBorder properties in flutter

I have a TextField(), I want to change the Underlineinput border color and the thickness of it since it looks to the thickness. I have tried my level to change it but it is not at all working.

I have followed these links but nothing worked for me :

  • InputDecoration class in flutter
  • InputBorder class in flutter
  • To change the color of the underline of textfield

Tried so far is :

CODE:

decoration: InputDeocration(
   border: UnderlineInputBorder(
     borderSide: new BorderSide(
        color: Color.fromRGBO(173, 179, 191, 1),
        width: 0.5,
        style: BorderStyle.none
     )
   )
)

The only thing that works or changes the color here is for the focussedBorder and enabledBorder. I don't want this, so I'm looking forward to getting some good advice here.

It doesn't change anything. What I want is :

Required Result

What I'm getting so far is this every time irrespective of the changes I make to the design :

Result

like image 948
Alok Avatar asked Apr 03 '19 06:04

Alok


People also ask

How do you customize TextFormField in Flutter?

To add a border to a TextField/TextFormField in Flutter, you can specify the decoration property and then use the InputDecoration and OutlineInputBorder widget. The OutlineInputBorder widget has the borderSide widget which you can use to pass in the BorderSide widget with width and color parameter to create the border.

How do you change the hint text color in Flutter?

In short, to change the hint color, set hintColor using Theme and ThemeData.


1 Answers

You can change the Underlineinput border color and the thickness Using the enabledBorder and focusedBorder properties.

TextField(
 decoration: InputDecoration(
    enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.red,width: 2.0)),
    focusedBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.teal,width: 5.0)),
    labelText: 'Your Email or Phone'
  )
)
like image 96
Android Team Avatar answered Sep 23 '22 14:09

Android Team