Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed bug when dismissing the dialog (#101) #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class _MyHomePageState extends State<MyHomePage> {
//################################################################################################
// Rounded blue MultiSelectDialogField
//################################################################################################
MultiSelectDialogField(
MultiSelectDialogField<Animal>(
items: _items,
title: Text("Animals"),
selectedColor: Colors.blue,
Expand Down Expand Up @@ -140,7 +140,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
child: Column(
children: <Widget>[
MultiSelectBottomSheetField(
MultiSelectBottomSheetField<Animal>(
initialChildSize: 0.4,
listType: MultiSelectListType.CHIP,
searchable: true,
Expand Down
6 changes: 4 additions & 2 deletions lib/bottom_sheet/multi_select_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ class MultiSelectBottomSheet<T> extends StatefulWidget
class _MultiSelectBottomSheetState<T> extends State<MultiSelectBottomSheet<T>> {
List<T> _selectedValues = [];
bool _showSearch = false;
List<MultiSelectItem<T>> _items;
late List<MultiSelectItem<T>> _items;

_MultiSelectBottomSheetState(this._items);
_MultiSelectBottomSheetState(List<MultiSelectItem<T>> _itemsList) {
_items = List.generate(_itemsList.length, (index) => MultiSelectItem<T>.fromOther(_itemsList[index]));
}

@override
void initState() {
Expand Down
6 changes: 4 additions & 2 deletions lib/dialog/mult_select_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,11 @@ class MultiSelectDialog<T> extends StatefulWidget with MultiSelectActions<T> {
class _MultiSelectDialogState<T> extends State<MultiSelectDialog<T>> {
List<T> _selectedValues = [];
bool _showSearch = false;
List<MultiSelectItem<T>> _items;
late List<MultiSelectItem<T>> _items;

_MultiSelectDialogState(this._items);
_MultiSelectDialogState(List<MultiSelectItem<T>> _itemsList) {
_items = List.generate(_itemsList.length, (index) => MultiSelectItem<T>.fromOther(_itemsList[index]));
}

@override
void initState() {
Expand Down
9 changes: 7 additions & 2 deletions lib/util/multi_select_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
class MultiSelectItem<T> {
final T value;
final String label;
bool selected = false;
bool selected;

MultiSelectItem(this.value, this.label);
MultiSelectItem(this.value, this.label, {this.selected = false});

MultiSelectItem.fromOther(MultiSelectItem<T> other)
: value = other.value,
label = other.label,
selected = other.selected;
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: multi_select_flutter
description: A flexible multi select package for Flutter. Make multi select widgets the way you want.
version: 4.1.2
version: 4.1.4
repository: https://github.com/CHB61/flutter-multi-select
issue_tracker: https://github.com/CHB61/flutter-multi-select
documentation: https://github.com/CHB61/flutter-multi-select
Expand Down