chips 0.0.2 copy "chips: ^0.0.2" to clipboard
chips: ^0.0.2 copied to clipboard

Add customizable and easy-to-use chip widgets to your Flutter apps for seamless user input and display.

example/lib/main.dart

import 'package:chips/chips.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Chips Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  var _values = ['Apple', 'Apricot', 'Banana', 'Kiwi'];
  var _selected = {'Banana'};

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        ChipsChoice(
          values: _values,
          selected: _selected,
          onChanged: _onChanged,
          onSelectionChanged: _onSelectionChanged,
        ),
        ChipsInputField(
          values: _values,
          onChanged: _onChanged,
          fromText: (text) => text,
        )
      ],
    );
  }

  void _onChanged(List<String> values) {
    setState(() => _values = values);
  }

  void _onSelectionChanged(Set<String> selected) {
    setState(() => _selected = selected);
  }
}
0
likes
140
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

Add customizable and easy-to-use chip widgets to your Flutter apps for seamless user input and display.

Repository (GitHub)
View/report issues

Topics

#chip

Documentation

API reference

License

MIT (license)

Dependencies

flutter, wrapfit

More

Packages that depend on chips