Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何在Flatter中使用正则表达式突出显示TextFormField小部件中的文本_Flutter - Fatal编程技术网

Flutter 如何在Flatter中使用正则表达式突出显示TextFormField小部件中的文本

Flutter 如何在Flatter中使用正则表达式突出显示TextFormField小部件中的文本,flutter,Flutter,当TextFormField与正则表达式匹配时,我想突出显示TextFormField中的文本。或者在下拉列表的TextFormField中插入文本。比如在网络上选择2。以下是一个例子: 假设您已经拥有了您的列表,您可以添加和删除列表中的数据: 你可以这样做: List<String> _myList = ["USA", "France",]; Container( width: double.infinity, child: Column( children: &l

当TextFormField与正则表达式匹配时,我想突出显示TextFormField中的文本。或者在下拉列表的TextFormField中插入文本。比如在网络上选择2。以下是一个例子:


假设您已经拥有了您的列表,您可以添加和删除列表中的数据:

你可以这样做:

List<String> _myList = ["USA", "France",];
Container(
  width: double.infinity,
  child: Column(
    children: <Widget>[
      Container(
        width: double.infinity,
        child: Row(
          children: <Widget>[
            for(var x= 0; x<_myList.length;x++)...{
              Container(
                height: 60,
                padding: EdgeInsets.symmetric(horizontal: 10),
                decoration: BoxDecoration(
                  color: Colors.grey[300],
                  borderRadius: BorderRadius.circular(7),
                ),
                child: Row(
                  children: <Widget>[
                    IconButton(
                      Icon(Icons.close),
                      onPressed: (){
                        removeData();
                      }
                    ),
                    Text(_myList[x])
                  ]
                )
              )
            }
          ]
        )
      ),
      Container(
        child: TextFormField(*your code with controller*)
      )
    ]
  )
)
List _myList=[“美国”、“法国”、];
容器(
宽度:double.infinity,
子:列(
儿童:[
容器(
宽度:double.infinity,
孩子:排(
儿童:[

对于(var x=0;xYou可以使用
Chip
s来实现这一点….!感谢您的建议。我将使用该芯片从输入框中显示所选项目。