搜索插件、代码仓与 APP 分类

flutter_tagging 封面
插件详情v3.0.0

flutter_tagging

一个具有标签或多重选择功能的 Flutter 包。适用于添加标签或标签选择表单。

近 30 天下载
117
喜欢数
183
Pub 分数
80

安装插件

flutter pub add flutter_tagging

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

Flutter Tagging 是一个 Flutter 包,提供标签和多选功能,使用户能够在表单中创建和管理标签或标签。它支持动态标签输入、删除以及通过芯片提供的视觉反馈,非常适合需要元数据分类、用户偏好或内容标签的应用程序。该包轻量且可无缝集成到现有 UI 中,并提供可自定义的样式选项。在用户需要高效选择或添加多个标签的表单中尤其有用。

适合场景

  • 带有多个标签的表单输入
  • 用户偏好选择
  • 内容分类
  • 基于标签的搜索筛选
  • 动态标签管理
  • 社交媒体帖子标签

主要特点

  • 多选芯片界面
  • 可自定义的标签样式
  • 实时标签添加/移除
  • 对自定义输入字段的支持
  • 轻量且易于集成
  • 响应式设计

适合对象

  • 开发表单密集型应用的开发者
  • 需要用户驱动标记的应用程序
  • 带有元数据分类的项目
  • 需要交互式芯片的UI组件
  • 带有标签过滤的移动应用

使用建议

  • 有限的平台特定自定义
  • 无内置验证
  • 需要手动处理标签数据的持久化
  • 未针对非常大的标签列表进行优化
  • 依赖外部状态管理来处理复杂用例

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Flutter Tagging

Pub Package licence

A flutter package with tagging or multi-select functionality. Useful for adding Tag or Label Selection Forms.

DEMO

List<Language> _selectedLanguages = [];

FlutterTagging<Language>(
    initialItems: _selectedLanguages,
    textFieldConfiguration: TextFieldConfiguration(
        decoration: InputDecoration(
            border: InputBorder.none,
            filled: true,
            fillColor: Colors.green.withAlpha(30),
            hintText: 'Search Tags',
            labelText: 'Select Tags',
        ),
    ),
    findSuggestions: LanguageService.getLanguages,
    additionCallback: (value) {
        return Language(
                name: value,
                position: 0,
        );
    },
    onAdded: (language){
      // api calls here, triggered when add to tag button is pressed
        return Language();
    },
    configureSuggestion: (lang) {
        return SuggestionConfiguration(
            title: Text(lang.name),
            subtitle: Text(lang.position.toString()),
            additionWidget: Chip(
                avatar: Icon(
                    Icons.add_circle,
                    color: Colors.white,
                ),
                label: Text('Add New Tag'),
                labelStyle: TextStyle(
                    color: Colors.white,
                    fontSize: 14.0,
                    fontWeight: FontWeight.w300,
                ),
                backgroundColor: Colors.green,
            ),
        );
    },
    configureChip: (lang) {
        return ChipConfiguration(
            label: Text(lang.name),
            backgroundColor: Colors.green,
            labelStyle: TextStyle(color: Colors.white),
            deleteIconColor: Colors.white,
        );
    },
    onChanged: () {
      print();
    }
);

/// LanguageService
class LanguageService {
    /// Mocks fetching language from network API with delay of 500ms.
    static Future<List<Language>> getLanguages(String query) async {
          await Future.delayed(Duration(milliseconds: 500), null);
          return <Language>[
            Language(name: 'JavaScript', position: 1),
            Language(name: 'Python', position: 2),
            Language(name: 'Java', position: 3),
            Language(name: 'PHP', position: 4),
            Language(name: 'C#', position: 5),
            Language(name: 'C++', position: 6),
          ].where((lang) => lang.name.toLowerCase().contains(query.toLowerCase())).toList();
    }
}

License

Copyright 2020 Sarbagya Dhaubanjar. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above
      copyright notice, this list of conditions and the following
      disclaimer in the documentation and/or other materials provided
      with the distribution.
    * Neither the name of Google Inc. nor the names of its
      contributors may be used to endorse or promote products derived
      from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。