首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用flutter_tagging清除选中的标签?

如何使用flutter_tagging清除选中的标签?
EN

Stack Overflow用户
提问于 2019-07-25 20:59:41
回答 1查看 118关注 0票数 2

我需要在我的应用程序中使用标签。为此,我找到了flutter_tagging库。我的问题是,当我点击按钮时,我不知道如何清除所选的标签。

代码语言:javascript
复制
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();
         });
       },
)
EN

回答 1

Stack Overflow用户

发布于 2019-07-26 16:30:05

我在这里看到两个选项:

  1. Fork库和add方法,它将清除小部件中的Map _selectedTagValues variable.
  2. Initiate Key taggingKey = UniqueKey() (UniqueKey),将其传递给FlutterTagging,并在您必须重置它并以初始状态重建整个FlutterTagging小部件时调用key.currentState.reset()
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57202563

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档