我需要在我的应用程序中使用标签。为此,我找到了flutter_tagging库。我的问题是,当我点击按钮时,我不知道如何清除所选的标签。
FlutterTagging(
textFieldDecoration: InputDecoration(
border: OutlineInputBorder(),
hintText: "Tags",
labelText: "Enter tags"),
addButtonWidget: _buildAddButton(),
chipsColor: Colors.pinkAccent,
chipsFontColor: Colors.white,
deleteIcon: Icon(Icons.cancel,color: Colors.white),
chipsPadding: EdgeInsets.all(2.0),
chipsFontSize: 14.0,
chipsSpacing: 5.0,
chipsFontFamily: 'helvetica_neue_light',
suggestionsCallback: (pattern) async {
return await TagSearchService.getSuggestions(pattern);
},
onChanged: (result) {
setState(() {
text = result.toString();
});
},
)发布于 2019-07-26 16:30:05
我在这里看到两个选项:
Map _selectedTagValues variable.Key taggingKey = UniqueKey() (UniqueKey),将其传递给FlutterTagging,并在您必须重置它并以初始状态重建整个FlutterTagging小部件时调用key.currentState.reset()。https://stackoverflow.com/questions/57202563
复制相似问题