パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v2.0.0

flutter_chips_input

InputChips を入力オプションとして使用して、入力フィールドを構築するためのFlutterライブラリ。

30日間ダウンロード
1900
いいね数
106
Pub ポイント
70

パッケージをインストール

flutter pub add flutter_chips_input

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

ユーザーが入力オプションとしてチップを追加および管理できる入力フィールドの作成を可能にするFlutterライブラリです。動的なチップの追加・削除・カスタマイズをサポートしており、タグ付けや選択ベースのフォームに最適です。このパッケージはFlutterのマテリアルデザインコンポーネントとシームレスに統合され、開発者がカスタムチップスタイル、検証ルール、入力動作を定義できます。ユーザー主導のコンテンツタグ付けや複数選択入力が必要な状況で特に有用です。

用途

  • タグシステム
  • マルチセレクトフォーム入力
  • 動的コンテンツフィルタリング
  • ユーザー生成キーワード入力
  • インタラクティブチップを備えたフォームフィールド
  • 推奨タグで検索

主な機能

  • インタラクティブなチップ入力
  • カスタマイズ可能なチップスタイル
  • リアルタイムチップ管理
  • 検証のサポート
  • 拡張可能な入力処理
  • 既存のフォームとの簡単な統合

適している対象

  • タグベースのUIを構築している開発者
  • 複数選択を必要とするフォーム
  • 動的なユーザー入力を持つアプリケーション
  • 入力に対する視覚フィードバックが必要なUI
  • モバイルアプリ用にFlutterを使用するチーム

注意事項

  • 制限されたプラットフォーム固有の動作ドキュメント
  • 組み込みの自動補完機能はありません
  • チップデータの永続化を手動で処理する必要があります
  • 複雑なレイアウトには追加のスタイリングが必要になる場合があります
  • 非常に大きなデータセットには最適化されていない

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

flutter_chips_input

Flutter library for building input fields with InputChips as input options.

Pub Version GitHub Workflow Status Codecov CodeFactor Grade

GitHub OSS Lifecycle Gitter

Usage

Installation

Follow installation instructions here

Import
import 'package:flutter_chips_input/flutter_chips_input.dart';
Example
ChipsInput
ChipsInput(
    initialValue: [
        AppProfile('John Doe', 'jdoe@flutter.io', 'https://d2gg9evh47fn9z.cloudfront.net/800px_COLOURBOX4057996.jpg')
    ],
    decoration: InputDecoration(
        labelText: "Select People",
    ),
    maxChips: 3,
    findSuggestions: (String query) {
        if (query.length != 0) {
            var lowercaseQuery = query.toLowerCase();
            return mockResults.where((profile) {
                return profile.name.toLowerCase().contains(query.toLowerCase()) || profile.email.toLowerCase().contains(query.toLowerCase());
            }).toList(growable: false)
                ..sort((a, b) => a.name
                    .toLowerCase()
                    .indexOf(lowercaseQuery)
                    .compareTo(b.name.toLowerCase().indexOf(lowercaseQuery)));
        } else {
            return const <AppProfile>[];
        }
    },
    onChanged: (data) {
        print(data);
    },
    chipBuilder: (context, state, profile) {
        return InputChip(
            key: ObjectKey(profile),
            label: Text(profile.name),
            avatar: CircleAvatar(
                backgroundImage: NetworkImage(profile.imageUrl),
            ),
            onDeleted: () => state.deleteChip(profile),
            materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
        );
    },
    suggestionBuilder: (context, state, profile) {
        return ListTile(
            key: ObjectKey(profile),
            leading: CircleAvatar(
                backgroundImage: NetworkImage(profile.imageUrl),
            ),
            title: Text(profile.name),
            subtitle: Text(profile.email),
            onTap: () => state.selectSuggestion(profile),
        );
    },
)

To-do list

  • [x] Ability to limit the number of chips
  • [x] Overlay doesn't move when input height changes i.e. when chips wrap
  • [ ] Create a FormField implementation (ChipsInputField) to be used within Flutter Form Widget

Known Issues

  • Deleting chips with keyboard on IOS makes app to crush (Flutter Issue with special characters used as replacement characters). Already reported #1
  • For some reason Overlay floats above AppBar when scrolling

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。