Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Flutter TextField border color on focus?

Tags:

I created a simple text field with input decoration and Outlineboraderinput. When I type on that text field I want to change the border color. Below link, you can see my work. What I want is change that blue border to white:

image

TextFormField(   decoration: InputDecoration(     labelText: "Resevior Name",     fillColor: Colors.white,     enabledBorder:OutlineInputBorder(       borderSide: const BorderSide(color: Colors.white, width: 2.0),         borderRadius: BorderRadius.circular(25.0),       ),     ),   ) 
like image 627
NicoleZ Avatar asked Feb 05 '19 15:02

NicoleZ


People also ask

How do you put a border on a TextField 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 border text color in Flutter?

Flutter – Change Container Border's Color & Width To change the color and width of Container's border, use its decoration property. Set decoration property with BoxDecoration() object. Set the border property of BoxDecoration() object, with required color and width as per your applications specifications.


1 Answers

Add focusBorder insted of enabledBorder

TextFormField(         decoration: InputDecoration(           labelText: "Resevior Name",           fillColor: Colors.white,           focusedBorder:OutlineInputBorder(             borderSide: const BorderSide(color: Colors.white, width: 2.0),             borderRadius: BorderRadius.circular(25.0),           ),         ),       ) 
like image 132
allence vakharia Avatar answered Sep 28 '22 11:09

allence vakharia