Home > Blockchain >  how to change the border color of this text field to white in flutter
how to change the border color of this text field to white in flutter

Time:01-27

how to change the border colour of this text field to white. here's my code for text field. default it display as a black border. I want to fill the text box with white colour and white padding.

Widget TextBox() => Container(
  child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
    Container(
        height: 60,
        width: 300,
        child: TextField(
          decoration: InputDecoration(
              border: OutlineInputBorder(borderRadius:BorderRadius.circular(15),  ),
              hintText: 'Enter Name',
              fillColor: Colors.white,filled: true
            // Border

          ),
        )),
  ]),
);

CodePudding user response:

Try this,

Widget TextBox() => Container(
  child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
    Container(
        height: 60,
        width: 300,
        child: TextField(
          decoration: InputDecoration(
           enabledBorder: OutlineInputBorder(
                  borderSide: BorderSide(color: Colors.white), // change color you want...
                ),
              border: OutlineInputBorder(borderRadius:BorderRadius.circular(15)),
              hintText: 'Enter Name',
              fillColor: Colors.white,filled: true
            // Border

          ),
        )),
  ]),
);

CodePudding user response:

You can use enabledBorder like this:

 Widget TextBox() => Container(
    child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
      Container(
          height: 60,
          width: 300,
          child: TextField(
            decoration: InputDecoration(
                enabledBorder: const OutlineInputBorder(
                  borderSide: const BorderSide(color: Colors.white, width: 0.0),
                ),
                border: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(15),
                ),
                hintText: 'Enter Name',
                fillColor: Colors.white,
                filled: true
                // Border

                ),
          )),
    ]),
  );
  •  Tags:  
  • Related