FLUTTER ECOSYSTEM

SanjaySodani/multiselect_dropdown_flutter

선택 항목 전체 및 검색 옵션을 갖춘 간단한 다중 선택 드롭다운입니다. 간단한 목록과 맵 목록과 함께 작동합니다.

다중선택 드롭다운_flutter 프로젝트 이미지
Stars
12
Forks
7
최근 푸시(UTC)
2023. 12. 30.
프로젝트 상태
활성
Sanjay Sodani GitHub avatar
GITHUB User

Sanjay Sodani ↗

SmartQBangalore
언어Dart

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^2.0.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기
  • A simple multiselect dropdown which has Select All and Search options.
  • You can use a simple list or a list of maps.

Features

MultiSelect Dropdown demo

  • Use MultiSelectDropdown for list of maps.
  • Use MultiSelectDropdown.simpleList for a simple list.

Getting started

  • Add the package in your flutter project.
  • Import the package import 'package:multiselect_dropdown_flutter/multiselect_dropdown_flutter.dart';.

Usage

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

  final List myList2 = const ['Dog', 'Cat', 'Mouse', 'Rabbit'];

  final List myList = const [
    {'id': 'dog', 'label': 'Dog'},
    {'id': 'cat', 'label': 'Cat'},
    {'id': 'mouse', 'label': 'Mouse'},
    {'id': 'rabbit', 'label': 'Rabbit'},
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          MultiSelectDropdown(
            list: myList,
            initiallySelected: const [],
            onChange: (newList) {
              // your logic
            },
          ),
          const SizedBox(height: 50),
          MultiSelectDropdown.simpleList(
            list: myList2,
            initiallySelected: const [],
            onChange: (newList) {
              // your logic
            },
            includeSearch: true,
            includeSelectAll: true,
          ),
        ],
      ),
    );
  }
}

Parameters

Parameter Name Description
list List of options to select from
label label key in a Map to show as an option. Defaults to 'label'
id id key in a Map to identify an item. Defaults to 'id'
onChange onChange callback, passes new list as argument
numberOfItemsLabelToShow Number of items to show as text, beyond that it will show n selected
initiallySelected Initially selected list
boxDecoration Decoration for anchor element
isLarge Dropdown size
width Anchor and modal width
whenEmpty Text to show when nothing is selected
includeSelectAll Includes a select all button when true
includeSearch Includes a search option when true
textStyle TextStyle? for the text on anchor element
duration Duration? for debounce in search option. Defaults to 300 milliseconds.
checkboxFillColor checkbox fill color
splashColor splash color on list tile
listTextStyle text style for text on list tile


 

I will keep adding more functionalities.
You can raise an issue/feature request on github.
Please leave a like if you find this package useful.