Flutter 如何在Flatter中使用正则表达式突出显示TextFormField小部件中的文本
当TextFormField与正则表达式匹配时,我想突出显示TextFormField中的文本。或者在下拉列表的TextFormField中插入文本。比如在网络上选择2。以下是一个例子:Flutter 如何在Flatter中使用正则表达式突出显示TextFormField小部件中的文本,flutter,Flutter,当TextFormField与正则表达式匹配时,我想突出显示TextFormField中的文本。或者在下拉列表的TextFormField中插入文本。比如在网络上选择2。以下是一个例子: 假设您已经拥有了您的列表,您可以添加和删除列表中的数据: 你可以这样做: List<String> _myList = ["USA", "France",]; Container( width: double.infinity, child: Column( children: &l
假设您已经拥有了您的列表,您可以添加和删除列表中的数据: 你可以这样做:
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来实现这一点….!感谢您的建议。我将使用该芯片从输入框中显示所选项目。