I can't remove the shadow and the background of the TextField, here is my code:
TextFormField(
decoration: InputDecoration.collapsed(),
validator: (input) =>
input == "" ? 'The task is empty' : null,
onSaved: (input) => task = input,
)
this is the result that I want
I always try BoxDecoration but no success because don't is compatible with TextFormField.
Steps to change TextField background color in FlutterStep 1: Locate the file where you have placed the TextField widget. Step 2: Inside the TextField widget, add the decoration parameter and assign the InputDecoration widget. Step 3: Inside the InputDecoration widget, add the filled parameter and set it to true .
clear(); As mentioned above there are various properties of TextEditingController(). One of them is clear(), and we will use it to clear the TextField.
static const Color transparent = Color(0x00000000); Flutter.
You should set filled to true.
TextField(decoration: InputDecoration( fillColor: Colors.red, filled: true)),
Wrap your TextFormField
inside a Container
and change its color
property to match your background color (as from your picture I'll assume its white
):
Container(
color: Colors.white, // or any color that matches your background
child: TextFormField(
decoration: InputDecoration.collapsed(),
validator: (input) => input == "" ? 'The task is empty' : null,
onSaved: (input) => task = input,
)
),
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With