Search packages, repositories and app categories

Package detailsv2.0.0

flutter_chips_input

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

30-day downloads
1.8K
Likes
106
Pub points
70

Install package

flutter pub add flutter_chips_input

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter library that enables the creation of input fields where users can add and manage chips as input options. It supports dynamic chip addition, removal, and customization, making it ideal for tagging or selection-based forms. The package integrates seamlessly with Flutter's material design components and allows developers to define custom chip styles, validation rules, and input behaviors. It is particularly useful in scenarios requiring user-driven content tagging or multi-selection inputs.

Use cases

  • Tagging systems
  • Multi-select form inputs
  • Dynamic content filtering
  • User-generated keyword entry
  • Form field with interactive chips
  • Search with suggested tags

Key features

  • Interactive chip input
  • Customizable chip styling
  • Real-time chip management
  • Support for validation
  • Extensible input handling
  • Easy integration with existing forms

Suitable for

  • Developers building tag-based UIs
  • Forms requiring multiple selections
  • Applications with dynamic user input
  • UIs needing visual feedback on input
  • Teams using Flutter for mobile apps

Considerations

  • Limited platform-specific behavior documentation
  • No built-in autocomplete feature
  • Requires manual handling of chip data persistence
  • May need additional styling for complex layouts
  • Not optimized for very large datasets

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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

Categories

Source repository

Projects using this package

No data available yet.