Skip to content

Commit 2b48b7a

Browse files
committed
Update SmartMultiSelectBuilderInfo and example
1 parent e311d89 commit 2b48b7a

File tree

7 files changed

+35
-24
lines changed

7 files changed

+35
-24
lines changed

CHANGELOG.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
1-
## [0.0.1] - 2019-11-25
1+
## [0.1.1] - 2019-11-26
22

3-
* A description for people who will use that package or version.
4-
* Add single choice select using page, popup, or bottom sheet
5-
* Add multiple choice select using page, popup, or bottom sheet
3+
* Add values field to SmartMultiSelectBuilderInfo class
4+
* Update default SmartMultiSelect placeholder
5+
* Update example
66

77
## [0.1.0] - 2019-11-26
88

99
* Fixed bug return value multi select not updated from popup and bottom sheet options
1010
* Update example
11-
* Format documents
11+
* Format documents
12+
13+
## [0.0.1] - 2019-11-25
14+
15+
* A description for people who will use that package or version.
16+
* Add single choice select using page, popup, or bottom sheet
17+
* Add multiple choice select using page, popup, or bottom sheet

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
11
# smart_select
22

3-
A new Flutter package project.
4-
5-
## Getting Started
6-
7-
This project is a starting point for a Dart
8-
[package](https://flutter.dev/developing-packages/),
9-
a library module containing code that can be shared easily across
10-
multiple Flutter or Dart projects.
11-
12-
For help getting started with Flutter, view our
13-
[online documentation](https://flutter.dev/docs), which offers tutorials,
14-
samples, guidance on mobile development, and a full API reference.
3+
Smart select allows you to easily convert your usual form selects to dynamic pages with grouped radio or checkbox inputs.

example/lib/options.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class _OptionsListState extends State<OptionsList> {
8585
Divider(indent: 15),
8686
SmartMultiSelect(
8787
title: 'Cars',
88+
placeholder: 'Choose one or more',
8889
value: _car,
8990
options: [
9091
{ 'value': 'hon', 'label': 'Honda' },
@@ -103,6 +104,19 @@ class _OptionsListState extends State<OptionsList> {
103104
{ 'value': 'for', 'label': 'Ford' },
104105
{ 'value': 'fer', 'label': 'Ferrari' },
105106
],
107+
builder: (context, info) {
108+
return ListTile(
109+
title: Text(info.title),
110+
subtitle: Text(
111+
info.values,
112+
style: TextStyle(color: Colors.grey),
113+
overflow: TextOverflow.ellipsis,
114+
maxLines: 1,
115+
),
116+
trailing: Icon(Icons.keyboard_arrow_right, color: Colors.grey),
117+
onTap: () => info.showOptions(context),
118+
);
119+
},
106120
onChange: (val) => setState(() => _car = val),
107121
),
108122
Divider(indent: 15),

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ packages:
8585
path: ".."
8686
relative: true
8787
source: path
88-
version: "0.1.0"
88+
version: "0.1.1"
8989
source_span:
9090
dependency: transitive
9191
description:

lib/multi_choice/builder.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class SmartMultiSelectBuilderInfo {
2626
List get selectedValue {
2727
return selected != null ? selected.map((x) => x['label']).toList() : null;
2828
}
29+
30+
String get values {
31+
return selected != null && selected.length > 0 ? selectedLabel.join(', ') : placeholder;
32+
}
2933
}
3034

3135
class SmartMultiSelectBuilderDefault extends StatelessWidget {
@@ -44,12 +48,10 @@ class SmartMultiSelectBuilderDefault extends StatelessWidget {
4448
Container(
4549
constraints: BoxConstraints(maxWidth: 100),
4650
child: Text(
47-
info.selected != null
48-
? info.selectedLabel.join(', ')
49-
: info.placeholder,
51+
info.values,
52+
style: TextStyle(color: Colors.grey),
5053
overflow: TextOverflow.ellipsis,
5154
maxLines: 1,
52-
style: TextStyle(color: Colors.grey),
5355
),
5456
),
5557
Padding(

lib/multi_choice/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class SmartMultiSelect extends StatefulWidget {
3030
SmartMultiSelect.popup({
3131
Key key,
3232
this.title,
33-
this.placeholder = 'Select one',
33+
this.placeholder = 'Select one or more',
3434
this.value,
3535
this.options,
3636
this.onChange,

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: smart_select
22
description: Smart select allows you to easily convert your usual form selects to dynamic pages with grouped radio or checkbox inputs.
33
author: Irfan Vigma Taufik<[email protected]>
44
homepage: https://github.com/davigmacode/flutter_smart_select
5-
version: 0.1.0
5+
version: 0.1.1
66

77
environment:
88
sdk: ">=2.1.0 <3.0.0"

0 commit comments

Comments
 (0)