Reputation: 1780
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:
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),
),
),
)
Upvotes: 44
Views: 100249
Reputation: 81310
In Flutter 2.5, you can change the focus color of the TextField
directly in the ThemeData
:
theme: ThemeData().copyWith(
// change the focus border color of the TextField
colorScheme: ThemeData().colorScheme.copyWith(primary: Colors.amber),
// change the focus border color when the errorText is set
errorColor: Colors.purple,
),
Upvotes: 12
Reputation: 1921
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),
),
),
)
Upvotes: 114