FLUTTER ECOSYSTEM

TaimoorHassan/multiselect

デフォルトでマルチセレクトが有効になっているシンプルなドロップダウンウィジェット

複数選択 のプロジェクト画像
Stars
12
Forks
68
最終プッシュ(UTC)
2024/05/29
プロジェクト状態
公開中
Taimoor Hassan GitHub avatar
GITHUB User

Taimoor Hassan ↗

言語C++CMakeDartHTMLSwiftCKotlinObjective-C

技術トピック

このリポジトリが公開するパッケージ

使用している依存関係

依存関係一覧 3 件
  • flutter{"sdk":"flutter"}
  • states_rebuilder^6.4.0
  • flutter_test開発用{"sdk":"flutter"}

元の README

以下は英語原文のスナップショットです。最新版は GitHub をご覧ください。

README を開く / 閉じる

multiselect

A simple Multiselect Dropdown

alt Demo

Usage

add it to pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  multiselect: # use latest version    

import it

// Imports all Widgets included in [multiselect] package
import 'package:multiselect/multiselect.dart';

Add the DropDownMultiSelect widget to your build method

// Import multiselct
import 'package:multiselect/multiselect.dart';


class Home extends StatefulWidget {
  const Home({Key? key}) : super(key: key);

  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {

  List<String> selected = [];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
      child: Padding(
        padding: const EdgeInsets.all(20.0),
        // DropDownMultiSelect comes from multiselect
        child: DropDownMultiSelect(
          onChanged: (List<String> x) {
            setState(() {
              selected =x;
            });
          },
          options: ['a' , 'b' , 'c' , 'd'],
          selectedValues: selected,
          whenEmpty: 'Select Something',
        ),
      ),
    ));
  }
}

And that is it. You will have a working multiselect DropDown with no effort at all.

 
 
 

PS: multiselect is planned to be a collection of multi-select widgets. I will add other functionality based on the needs of the community