项目作者: stevenosse

项目描述 :
A flutter dropdown button Widget allowing one to choose multiple elements.
高级语言: Dart
项目地址: git://github.com/stevenosse/multi_select_form_field.git
创建时间: 2020-07-25T10:06:44Z
项目社区:https://github.com/stevenosse/multi_select_form_field

开源协议:Other

下载


Multi Select Form Field

A dropdown button Widget allowing one to choose multiple elements.

Install

Add these line under your dependencies section:

  1. multiselect_form_field:
  2. git:
  3. url: https://github.com/stevenosse/multi_select_form_field.git
  4. ref: master

Demo

alt text

Features

  • Regular widget
  • Very simple to implement
  • Can retrieve the list of selected elements
  • Build custom list elements
  • Can retrieve the list of unselected elements

Example

  1. MultiSelectFormField(
  2. key: _multiSelectKey,
  3. tagColor: Colors.blue,
  4. elementList: List.generate(
  5. 15,
  6. (index) => MultiSelectFormFieldItem(
  7. labelStyle: TextStyle(fontWeight: FontWeight.w600),
  8. leading: CircleAvatar(),
  9. label: "Test $index",
  10. value: "test",
  11. isSelected: index.isEven,
  12. ),
  13. ),
  14. ),

Retrieve more parameters

Give a Key to the widget, declared like :

  1. final GlobalKey<MultiSelectFieldState> _multiSelectKey = GlobalKey();`

And then :

  1. var selectedElements = _multiSelectKey.currentState.selectedElements; // Retrieve all the selected elements
  2. var unselectedElements = _multiSelectKey.currentState.unselectedElements; // Retrieve all the unselected elements

Contribute

Every contributions are welcomed