Flutter: Outline input border - dart

I was trying to build a border for my text field like:
return TextField(
...
border: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
width: 5.0),
)
)
)
But it always return a black border with 1.0 as width.
The only way that I found to change the color was to create a ThemeData where I specify the hint color, but I could not find a way to change my width.

What your looking for is - enabledBorder property of InputDecoration.
If you want to Change Border on focus use - focusedBorder
TextField(
decoration: new InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.greenAccent, width: 5.0),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red, width: 5.0),
),
hintText: 'Mobile Number',
),
),

For others coming here who just want a TextField with a border all around it:
TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
),
),

You can change the outlined variant of TextField or TextFormField globally by overriding the ThemeData at the top level:
return MaterialApp(
theme: ThemeData(
inputDecorationTheme: const InputDecorationTheme(border: OutlineInputBorder()),
),
)
Live Demo

Related

Flutter change textfield underline Color

I am trying to change the underline color of a textfield when it's inactive/not focused. I am not sure where to make this change, InputDecorationTheme is only changing the underline color for when it's selected. How do I achieve this?
inputDecorationTheme: new InputDecorationTheme(
labelStyle: new TextStyle(
color: Colors.blue[200],
),
hintStyle: new TextStyle(color: Colors.grey),
),
I am trying to change this color the textfield to a lighter grey when it's not selected/out of focus.
For those who might need to achieve something similar, change the hintColor in your Theme widget.
new Theme(
data: new ThemeData(
//this changes the colour
hintColor: Colors.grey,
inputDecorationTheme: new InputDecorationTheme(
labelStyle: new TextStyle(color: Colors.blue))));
We can use InputDecoration
Try this way
new TextFormField(
controller: passTextController,
decoration: new InputDecoration(
labelText: "Enter password",
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
// when the TextFormField in unfocused
) ,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
// when the TextFormField in focused
) ,
border: UnderlineInputBorder(
)
),
keyboardType: TextInputType.text,
obscureText: true,
),
OUTPUT

Not able to change TextField Border Color

I am trying to change color of the border of my TextField using a BorderSide, but it does not work.
This is my code below.
new TextField(
decoration: new InputDecoration(
border: new OutlineInputBorder(
borderSide: new BorderSide(color: Colors.teal)
),
hintText: 'Tell us about yourself',
helperText: 'Keep it short, this is just a demo.',
labelText: 'Life story',
prefixIcon: const Icon(Icons.person, color: Colors.green,),
prefixText: ' ',
suffixText: 'USD',
suffixStyle: const TextStyle(color: Colors.green)),
)
)
Screenshot of the result is shown below.
The new way to do it is to use enabledBorder like this:
new TextField(
decoration: new InputDecoration(
enabledBorder: const OutlineInputBorder(
borderSide: const BorderSide(color: Colors.grey, width: 0.0),
),
focusedBorder: ...
border: ...
),
)
That is not changing due to the default theme set to the screen.
So just change them for the widget you are drawing by wrapping your TextField with new ThemeData()
child: new Theme(
data: new ThemeData(
primaryColor: Colors.redAccent,
primaryColorDark: Colors.red,
),
child: new TextField(
decoration: new InputDecoration(
border: new OutlineInputBorder(
borderSide: new BorderSide(color: Colors.teal)),
hintText: 'Tell us about yourself',
helperText: 'Keep it short, this is just a demo.',
labelText: 'Life story',
prefixIcon: const Icon(
Icons.person,
color: Colors.green,
),
prefixText: ' ',
suffixText: 'USD',
suffixStyle: const TextStyle(color: Colors.green)),
),
));
Well, I really don't know why the color assigned to border does not work. But you can control the border color using other border properties of the textfield. They are:
disabledBorder: Is activated when enabled is set to false
enabledBorder: Is activated when enabled is set to true (by default enabled property of TextField is true)
errorBorder: Is activated when there is some error (i.e. a failed validate)
focusedBorder: Is activated when we click/focus on the TextField.
focusedErrorBorder: Is activated when there is error and we are currently focused on that TextField.
A code snippet is given below:
TextField(
enabled: false, // to trigger disabledBorder
decoration: InputDecoration(
filled: true,
fillColor: Color(0xFFF2F2F2),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(4)),
borderSide: BorderSide(width: 1,color: Colors.red),
),
disabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(4)),
borderSide: BorderSide(width: 1,color: Colors.orange),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(4)),
borderSide: BorderSide(width: 1,color: Colors.green),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(4)),
borderSide: BorderSide(width: 1,)
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(4)),
borderSide: BorderSide(width: 1,color: Colors.black)
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(4)),
borderSide: BorderSide(width: 1,color: Colors.yellowAccent)
),
hintText: "HintText",
hintStyle: TextStyle(fontSize: 16,color: Color(0xFFB3B1B1)),
errorText: snapshot.error,
),
controller: _passwordController,
onChanged: _authenticationFormBloc.onPasswordChanged,
obscureText: false,
),
disabledBorder:
enabledBorder:
focusedBorder:
errorBorder:
errorFocusedBorder:
The code in which you change the color of the primaryColor andprimaryColorDark does not change the color inicial of the border, only after tap the color stay black
The attribute that must be changed is hintColor
BorderSide should not be used for this, you need to change Theme.
To make the red color default to put the theme in MaterialApp(theme: ...) and to change the theme of a specific widget, such as changing the default red color to the yellow color of the widget, surrounds the widget with:
new Theme(
data: new ThemeData(
hintColor: Colors.yellow
),
child: ...
)
Below is the code and gif:
Note that if we define the primaryColor color as black, by tapping the widget it is selected with the color black
But to change the label and text inside the widget, we need to set the theme to InputDecorationTheme
The widget that starts with the yellow color has its own theme and the widget that starts with the red color has the default theme defined with the function buildTheme()
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
ThemeData buildTheme() {
final ThemeData base = ThemeData();
return base.copyWith(
hintColor: Colors.red,
primaryColor: Colors.black,
inputDecorationTheme: InputDecorationTheme(
hintStyle: TextStyle(
color: Colors.blue,
),
labelStyle: TextStyle(
color: Colors.green,
),
),
);
}
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return new MaterialApp(
theme: buildTheme(),
home: new HomePage(),
);
}
}
class HomePage extends StatefulWidget {
#override
_HomePageState createState() => new _HomePageState();
}
class _HomePageState extends State<HomePage> {
String xp = '0';
#override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(),
body: new Container(
padding: new EdgeInsets.only(top: 16.0),
child: new ListView(
children: <Widget>[
new InkWell(
onTap: () {},
child: new Theme(
data: new ThemeData(
hintColor: Colors.yellow
),
child: new TextField(
decoration: new InputDecoration(
border: new OutlineInputBorder(),
hintText: 'Tell us about yourself',
helperText: 'Keep it short, this is just a demo.',
labelText: 'Life story',
prefixIcon: const Icon(Icons.person, color: Colors.green,),
prefixText: ' ',
suffixText: 'USD',
suffixStyle: const TextStyle(color: Colors.green)),
)
)
),
new InkWell(
onTap: () {},
child: new TextField(
decoration: new InputDecoration(
border: new OutlineInputBorder(
borderSide: new BorderSide(color: Colors.teal)
),
hintText: 'Tell us about yourself',
helperText: 'Keep it short, this is just a demo.',
labelText: 'Life story',
prefixIcon: const Icon(Icons.person, color: Colors.green,),
prefixText: ' ',
suffixText: 'USD',
suffixStyle: const TextStyle(color: Colors.green)),
)
)
],
),
)
);
}
}
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide(color: Colors.red)
),
TextField(
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(4.0)),
borderSide: BorderSide(width: 1.0),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blueGrey),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.redAccent),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.orangeAccent),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
contentPadding: EdgeInsets.all(10.0),
hintText: 'Tell us about yourself',
helperText: 'Keep it short, this is just a demo.',
labelText: 'Life story',
prefixIcon: const Icon(
Icons.person,
color: Colors.green,
),
prefixText: ' ',
suffixText: 'USD',
suffixStyle: const TextStyle(color: Colors.green),
),
),
The best and most effective solution is just adding theme in your main class and add input decoration like these.
theme: ThemeData(
inputDecorationTheme: InputDecorationTheme(
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.pink)
)
),
)
Inside your lib file
Create a folder called colors.
Inside the colors folder create a dart file and name it color.
Paste this code inside it
const MaterialColor primaryOrange = MaterialColor(
_orangePrimaryValue,
<int, Color>{
50: Color(0xFFFF9480),
100: Color(0xFFFF9480),
200: Color(0xFFFF9480),
300: Color(0xFFFF9480),
400: Color(0xFFFF9480),
500: Color(0xFFFF9480),
600: Color(0xFFFF9480),
700: Color(0xFFFF9480),
800: Color(0xFFFF9480),
900: Color(0xFFFF9480),
},
);
const int _orangePrimaryValue = 0xFFFF9480;
Go to your main.dart file and place this code in your theme
theme:ThemeData(
primarySwatch: primaryOrange,
),
Import the color folder in your main.dart like this import 'colors/colors.dart';
border: OutlineInputBorder(borderSide: BorderSide(color: CustomColors.primaryColor),),
We have tried custom search box with the pasted snippet. This code will useful for all kind of TextFiled decoration in Flutter. Hope this snippet will helpful for others.
Container(
margin: EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 10.0),
child: new Theme(
data: new ThemeData(
hintColor: Colors.white,
primaryColor: Colors.white,
primaryColorDark: Colors.white,
),
child:Padding(
padding: EdgeInsets.all(10.0),
child: TextField(
style: TextStyle(color: Colors.white),
onChanged: (value) {
filterSearchResults(value);
},
controller: editingController,
decoration: InputDecoration(
labelText: "Search",
hintText: "Search",
prefixIcon: Icon(Icons.search,color: Colors.white,),
enabled: true,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderRadius: BorderRadius.all(Radius.circular(25.0))),
border: OutlineInputBorder(
borderSide: const BorderSide(color: Colors.white, width: 0.0),
borderRadius: BorderRadius.all(Radius.circular(25.0)))),
),
),
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 40),
child: TextField(
cursorColor: Color.fromRGBO(25, 118, 218, 1),
decoration: new InputDecoration(
border: new OutlineInputBorder(
borderSide:
new BorderSide(color: Color.fromRGBO(25, 118, 218, 1)),
),
focusedBorder: new OutlineInputBorder(
borderSide:
new BorderSide(color: Color.fromRGBO(25, 118, 218, 1)),
),
labelText: "Edit Phone",
labelStyle: TextStyle(
color: Colors.grey,
),
prefixIcon: const Icon(
Icons.phone_outlined,
color: Color.fromRGBO(25, 118, 218, 1),
),
),
),
),
Thank me later :)
You can use this code for bottom sheets as well as for normal text fields :
class TextFieldForDropDown extends StatelessWidget {
final String title;
final String hintText;
final TextEditingController textEditingController;
bool isPassword;
final Function onTap;
final bool enable;
TextFieldForDropDown({this.title, this.hintText, this.textEditingController, this.isPassword = false, this.onTap, this.enable});
#override
Widget build(BuildContext context) {
var titleTextStyle = TextStyle(
color: Color(0xff9098C8),
fontSize: 12,
fontWeight: FontWeight.w400,
fontFamily: "Muli",
);
var textFieldTextStyle = TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w400,
fontFamily: "Muli",
);
var borderSides = OutlineInputBorder(borderSide: new BorderSide(color: Color(0xff38406B)));
var borderSides1 = OutlineInputBorder(borderSide: new BorderSide(color: Color(0xffdae4ff)));
return InkWell(
onTap: onTap,
child: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(this.title, style: titleTextStyle),
SizedBox(height: 8),
TextFormField(
enabled: enable,
// onTap: onTap,
obscureText: isPassword,
style: textFieldTextStyle,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(horizontal: 8, vertical: 8),
hintText: this.hintText,
hintStyle: titleTextStyle,
border: textEditingController.text != "" ? borderSides1 :borderSides,
enabledBorder: textEditingController.text != "" ? borderSides1 :borderSides,
disabledBorder: textEditingController.text != "" ? borderSides1 :borderSides,
focusedBorder: OutlineInputBorder(borderSide: new BorderSide(color: Color(0xffdae4ff))),
),
controller: textEditingController,
)
],
),
),
);
}
}
and use like this :
TextFieldForDropDown(
title: 'Phone Number*',
hintText: '+123-22-223-00',
textEditingController: viewModel.phoneController,
),

How to align Hint Text into centre in Text Field?

i am trying to add alignment to the hint-text inside Text-field.but it is not working. How to bring it to centre??
How to write text in curved shape???
Container(
child: new TextFormField(
controller: _pass,
textAlign: TextAlign.center,
decoration: new InputDecoration.collapsed(
hintText: " PASSWORD", ), )),
use textAlign: TextAlign.center, inside TextFormField or textfield
here is the code
The Output Like This
My problem was the auto content padding:
TextField(
textAlign: TextAlign.center,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0),
hintText: "hola mundo",
),
),
Happy coding.
The textHint will have the same Alignment as the input text. So you can try the code below to achieve what you're looking for:
TextFormField(
keyboardType: TextInputType.number,
maxLength: 5,
textAlign: TextAlign.center,
autofocus: true,
initialValue: '',
decoration: InputDecoration(
hintText: 'some hint',
counterText: "",
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(5.0)),
),
);
Note: specific case, but might help others who tried everything else from this thread.
I had a design from which I copied all the paddings and alignments, but I somehow couldn't center the hint text, it was always a few pixels closer to the top edge.
The only thing that worked was finding out that there was a specific text height set in the design. After I applied that, everything aligned perfectly.
InputDecoration(
hintStyle: TextStyle(
fontSize: _smallFontSize, // or whatever
height: 1.4, // <----- this was the key
),
// other properties...
);
you can add textAlign: TextAlign.center to your code
here is my code and its works:
new Padding(
padding: new EdgeInsets.all(30.0),
child:
new TextField(
textAlign: TextAlign.center,
decoration: new InputDecoration(
border: new OutlineInputBorder(
borderSide: new BorderSide(color: Colors.teal)),
hintText: 'REF: 2',
),
),
),
all of the answers work for the fixed-sized text fields but in my case, I m using a dynamically sized container that parents my text field
AnimatedContainer(
width: (!widget.scrollController.hasClients ||
widget.scrollController.positions.length > 1)
? MediaQuery.of(context).size.width.toDouble()
: max(
MediaQuery.of(context).size.width -
widget.scrollController.offset.roundToDouble(),
(MediaQuery.of(context).size.width - 80.w).toDouble()),
duration: const Duration(milliseconds: 150),
constraints: BoxConstraints(maxHeight: 40.h),
margin: EdgeInsets.zero,
child: TextField(
controller: controller,
expands: true,
minLines: null,
maxLines: null,
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
filled: true,
fillColor: MyAppColors.primaryColor1,
border: UnderlineInputBorder(
borderRadius:
BorderRadius.circular(15.w)),
prefixIcon: Icon(
Icons.search,
size: 20.w,
color: Theme.of(context).accentColor,
),
hintText: 'Songs, albums or artists',
contentPadding: EdgeInsets.zero,
hintStyle:
Theme.of(context).textTheme.subtitle2!.copyWith(
color: Colors.white.withOpacity(0.8),
fontSize: 18.sp,
)),
),
);
the solution that worked for me is that I set expand parameter to true and set these parameters:
minLines: null,
maxLines: null,
expands: true,
textAlignVertical: TextAlignVertical.center
the min and max line must be set to null in order to expand.
that is the only solution I found cuz in another way my hint text gain extra padding even I set the content padding to zero my hint text is not centered in other screen sizes.
You can use following attribute of TextFormField:
textAlign: TextAlign.center
This used to work earlier but now it doesn't. There's a recently opened issue in flutter repo which you can follow
Edit
Now works as expected.
textAlign: TextAlign.center will move your focus too, i fix it with some empty spaces in hint text
hintText: ' this is centred text)',

How to change textField underline color?

I'm new to both flutter & dart. Currently, using this in one of my personal projects.
In all of my form, the underline of textField is showing in blue color. I want to change that to some other color. The piece of code which I'm using is like...
new TextField(
controller: this._emailController,
decoration: new InputDecoration(
hintText: "Enter your email",
labelText: "Email",
labelStyle: new TextStyle(
color: const Color(0xFF424242)
)
),
),
Can't able to understand how to achieve this.
Note: I know there is a similar question at here Change TextField's Underline in Flutter. But, at there also it has not completely solved. Also, one more link which looks similar to mine at here Changing EditText bottom line color with appcompat v7 but, that actually belong to Android development by using JAVA not DART(flutter) which I'm using for my android app development. So, please don't get confused about those links.
Just used -:
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.cyan),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.cyan),
),
),
it works for me :)
** See update below or see the answer by #GJJ2019 **
The logical answer would be to use an InputBorder, particularly an UnderlineInputDecorator, and pass it in to the inputdecorator as the border. However, all this does is tell the InputDecorator whether is should use an underline or whatever else you specify.
The actual color is based on the theme - from the source:
Color _getActiveColor(ThemeData themeData) {
if (isFocused) {
switch (themeData.brightness) {
case Brightness.dark:
return themeData.accentColor;
case Brightness.light:
return themeData.primaryColor;
}
}
return themeData.hintColor;
}
So to change the colour do something like this (or specify the theme for your entire application):
new Theme(
data: new ThemeData(
primaryColor: Colors.red,
accentColor: Colors.orange,
hintColor: Colors.green
),
child: new TextField(
decoration: new InputDecoration(
hintText: "Enter your email",
labelText: "Email",
labelStyle: new TextStyle(color: const Color(0xFF424242)),
border: new UnderlineInputBorder(
borderSide: new BorderSide(
color: Colors.red
)
)
),
),
),
UPDATE:
This is now possible to do in the way you'd expect it to work.
decoration: InputDecoration(
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: theColor),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: theColor),
),
border: UnderlineInputBorder(
borderSide: BorderSide(color: theColor),
),
)
To change the color for the entire app, use ThemeData's inputDecorationTheme property.
To use the color only when the input is in focus (i.e. clicked & ready to type):
MaterialApp(
...
theme: ThemeData(
inputDecorationTheme: InputDecorationTheme(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red)
),
)
)
)
To always use the color (even when not in focus), set enabledBorder and border as well:
MaterialApp(
...
theme: ThemeData(
inputDecorationTheme: InputDecorationTheme(
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red)
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red),
),
border: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.red),
),
)
)
)
decoration: new InputDecoration(
labelText: "Email",
suffixIcon: Icon(Icons.email),
labelStyle: TextStyle(color: Colors.red),
enabledBorder: new UnderlineInputBorder(
borderSide: new BorderSide(color: Colors.red)
)
)
By using InputDecoration, you can set underline color as per your requirement.
TextField(
decoration: InputDecoration(
hintText: "Enter your email",
// [enabledBorder], displayed when [TextField, InputDecoration.enabled] is true
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.lightBlueAccent),
),
//[focusedBorder], displayed when [TextField, InputDecorator.isFocused] is true
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.redAccent),
),
)
)
need change three border.
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: _type.color),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: _type.color),
),
border:
OutlineInputBorder(borderSide: BorderSide(color: _type.color)),
with focusedBorder property in TextField can change underline color like :
focusedBorder: new UnderlineInputBorder( borderSide: new BorderSide(color: Colors.black), ),
#override
ThemeData appBarTheme(BuildContext context) {
return Theme.of(context).copyWith(
primaryColor: Colors.transparent,
appBarTheme: AppBarTheme(elevation: 0),
inputDecorationTheme: InputDecorationTheme(
border: UnderlineInputBorder(
borderSide: BorderSide(style: BorderStyle.none, width: 0))));
}

How to make the background of TextField rectangular box shape?

I tried making Container widget with rectangle shape in TextField. It doesn't show my text inside container. Rather the box shape comes above TextField.
Here's my code:
new Container(
height: 10.0,
width: 20.0,
decoration: new BoxDecoration(
shape: BoxShape.rectangle,
border: new Border.all(
color: Colors.black,
width: 1.0,
),
),
child: new TextField(
textAlign: TextAlign.center,
decoration: new InputDecoration(
hintText: '1',
border: InputBorder.none,
),
),
),
Just remove the height and width property of the container.
Example:
new Container(
decoration: new BoxDecoration(
shape: BoxShape.rectangle,
border: new Border.all(
color: Colors.black,
width: 1.0,
),
),
child: new TextField(
textAlign: TextAlign.center,
decoration: new InputDecoration(
hintText: '1',
border: InputBorder.none,
),
),
)
or else just specify the border property of InputDecoration like
new TextField(
textAlign: TextAlign.center,
decoration: new InputDecoration(
hintText: '1',
border: new OutlineInputBorder(
borderRadius: const BorderRadius.all(
const Radius.circular(0.0),
),
borderSide: new BorderSide(
color: Colors.black,
width: 1.0,
),
),
),
)
Hope that helps
TextField(
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 2.0),
),
hintText: 'Email',
prefixIcon: Icon(Icons.mail_outline),
),
),
Output:
TextField(
decoration: InputDecoration(
filled: true, // <- this is required.
border: const OutlineInputBorder(
borderRadius: kStadiumBorderRadius,
borderSide: BorderSide.none,
),
),
);

Resources