如何更改焦点上的Flutter文本字段边框颜色 [英] How to Change Flutter Text Field Border Color On Focus

查看:84
本文介绍了如何更改焦点上的Flutter文本字段边框颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用输入装饰和Outlineboraderinput创建了一个简单的文本字段.当我在该文本字段上键入内容时,我想更改边框颜色.在下面的链接中,您可以看到我的作品.我想要的是将蓝色边框更改为白色

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),
          ),
        ),
      )

推荐答案

添加由enabledBorder插入的focusBorder

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),
          ),
        ),
      )

这篇关于如何更改焦点上的Flutter文本字段边框颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆