flutter_chips_input 1.5.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 94

flutter_chips_input #

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

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
  • [ ] 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
  • Overlay doesn't move when input height changes i.e. when chips wrap
  • For some reason Overlay floats above AppBar when scrolling

[1.5.1] - 02-Oct-2019

  • Fix setEditingState error. Close #16

[1.5.0] - 23-Sep-2019

  • Added TextInputConfiguration options - inputType, obscureText, autocorrect, actionLabel, inputAction, keyboardAppearance.
  • Use theme's cursorColor instead of primaryColor

[1.4.0] - 23-Sep-2019

  • Resize the suggestions overlay when on-screen keyboard appears
  • Fixed iOS crash when deleting a chip with the keyboard. Closes #1. Thanks to Dmitry Korchagin

[1.3.1] - 15-Aug-2019

  • Resolve overlay assertion error '_overlay != null': is not true.

[1.3.0] - 12-Jun-2019

  • New attribute textStyle allows changing the TextStyle of the TextInput

[1.2.1] - 12-Jun-2019

[1.2.0] - 25-Mar-2019

  • Max number of chips can now be set using maxChips attribute

[1.1.0] - 26-Jan-2019

  • Input can now be disabled by setting enabled attribute to false

[1.0.4] - 17-Jan-2019

  • Fixed bug in later versions of Flutter where implementation of abstract method void updateFloatingCursor(RawFloatingCursorPoint point); missing
  • Fixed bug where initialValue chips cannot be deleted with keyboard
  • Fixed bug where onChanged() not fired when deleting chip using keyboard

[1.0.3] - 16-Dec-2018

  • Minor improvements in documentation

[1.0.2] - 16-Dec-2018

  • Improved library description.
  • Properly formatted example code in README

[1.0.1] - 15-Dec-2018

  • Added example to README

[1.0.0] - 15-Dec-2018

  • Initial release.

example/README.md

example #

Example Project for flutter_chips_input

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_chips_input: ^1.5.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_chips_input/flutter_chips_input.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
88
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
94
Learn more about scoring.

We analyzed this package on Oct 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test