简体   繁体   中英

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

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

          ),
        )),
  ]),
);

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

          ),
        )),
  ]),
);

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

                ),
          )),
    ]),
  );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM