Skip to content

Commit 30e82cb

Browse files
committed
Swap position generic type helper function for create list option from any list
1 parent e0b918d commit 30e82cb

24 files changed

+68
-64
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [3.0.3] - 2020-01-22
2+
3+
* Swap position generic type helper function for create list option from any list
4+
15
## [3.0.2] - 2020-01-22
26

37
* Support disabled and hidden option

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ List<Map<String, String>> days = [
115115
SmartSelect<T>.single/multiple(
116116
...,
117117
...,
118-
options: SmartSelectOption.listFrom<Map<String, String>, String>(
118+
options: SmartSelectOption.listFrom<T, Map<String, String>>(
119119
source: days,
120120
value: (index, item) => item['value'],
121121
title: (index, item) => item['title'],

example/art/demo/SmartSelect.apk

-647 Bytes
Binary file not shown.

example/lib/features_choices/choices_divider.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class _FeaturesChoicesDividerState extends State<FeaturesChoicesDivider> {
2222
placeholder: 'Choose one',
2323
isTwoLine: true,
2424
value: _car,
25-
options: SmartSelectOption.listFrom<Map, String>(
25+
options: SmartSelectOption.listFrom<String, Map>(
2626
source: options.cars,
2727
value: (index, item) => item['value'],
2828
title: (index, item) => item['title'],
@@ -43,7 +43,7 @@ class _FeaturesChoicesDividerState extends State<FeaturesChoicesDivider> {
4343
placeholder: 'Choose one',
4444
value: _smartphone,
4545
isTwoLine: true,
46-
options: SmartSelectOption.listFrom<Map, String>(
46+
options: SmartSelectOption.listFrom<String, Map>(
4747
source: options.smartphones,
4848
value: (index, item) => item['id'],
4949
title: (index, item) => item['name'],

example/lib/features_choices/choices_grouped.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ class FeaturesChoicesGrouped extends StatefulWidget {
1010
class _FeaturesChoicesGroupedState extends State<FeaturesChoicesGrouped> {
1111

1212
String _smartphone = '';
13-
List _car = [];
13+
List<String> _car = [];
1414

1515
@override
1616
Widget build(BuildContext context) {
1717
return Column(
1818
children: <Widget>[
1919
Container(height: 7),
20-
SmartSelect.single(
20+
SmartSelect<String>.single(
2121
title: 'Smartphones',
2222
placeholder: 'Choose one',
2323
isTwoLine: true,
2424
value: _smartphone,
25-
options: SmartSelectOption.listFrom<Map, String>(
25+
options: SmartSelectOption.listFrom<String, Map>(
2626
source: options.smartphones,
2727
value: (index, item) => item['id'],
2828
title: (index, item) => item['name'],
@@ -36,12 +36,12 @@ class _FeaturesChoicesGroupedState extends State<FeaturesChoicesGrouped> {
3636
onChange: (val) => setState(() => _smartphone = val),
3737
),
3838
Divider(indent: 20),
39-
SmartSelect.multiple(
39+
SmartSelect<String>.multiple(
4040
title: 'Cars',
4141
placeholder: 'Choose one or more',
4242
isTwoLine: true,
4343
value: _car,
44-
options: SmartSelectOption.listFrom<Map, String>(
44+
options: SmartSelectOption.listFrom<String, Map>(
4545
source: options.cars,
4646
value: (index, item) => item['value'],
4747
title: (index, item) => item['title'],

example/lib/features_choices/choices_theme.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ class FeaturesChoicesTheme extends StatefulWidget {
1010

1111
class _FeaturesChoicesThemeState extends State<FeaturesChoicesTheme> {
1212

13-
List _smartphones = [];
13+
List<String> _smartphones = [];
1414

1515
@override
1616
Widget build(BuildContext context) {
1717
return Column(
1818
children: <Widget>[
1919
Container(height: 7),
20-
SmartSelect.multiple(
20+
SmartSelect<String>.multiple(
2121
title: 'Smartphones',
2222
value: _smartphones,
2323
isTwoLine: true,
2424
leading: IconBadge(
2525
icon: const Icon(Icons.shopping_cart),
2626
counter: _smartphones.length,
2727
),
28-
options: SmartSelectOption.listFrom<Map, String>(
28+
options: SmartSelectOption.listFrom<String, Map>(
2929
source: options.smartphones,
3030
value: (index, item) => item['id'],
3131
title: (index, item) => item['name'],

example/lib/features_modal/modal_confirm.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ class FeaturesModalConfirm extends StatefulWidget {
99

1010
class _FeaturesModalConfirmState extends State<FeaturesModalConfirm> {
1111

12-
List _day = ['fri'];
13-
List _fruit = ['mel'];
12+
List<String> _day = ['fri'];
13+
List<String> _fruit = ['mel'];
1414
String _hero = 'iro';
1515

1616
@override
1717
Widget build(BuildContext context) {
1818
return Column(
1919
children: <Widget>[
2020
Container(height: 7),
21-
SmartSelect.multiple(
21+
SmartSelect<String>.multiple(
2222
title: 'Days',
2323
value: _day,
2424
isTwoLine: true,
@@ -33,7 +33,7 @@ class _FeaturesModalConfirmState extends State<FeaturesModalConfirm> {
3333
onChange: (val) => setState(() => _day = val)
3434
),
3535
Divider(indent: 20),
36-
SmartSelect.multiple(
36+
SmartSelect<String>.multiple(
3737
title: 'Fruit',
3838
value: _fruit,
3939
isTwoLine: true,
@@ -50,7 +50,7 @@ class _FeaturesModalConfirmState extends State<FeaturesModalConfirm> {
5050
onChange: (val) => setState(() => _fruit = val),
5151
),
5252
Divider(indent: 20),
53-
SmartSelect.single(
53+
SmartSelect<String>.single(
5454
title: 'Super Hero',
5555
value: _hero,
5656
isTwoLine: true,

example/lib/features_modal/modal_filter.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ class FeaturesModalFilter extends StatefulWidget {
1010
class _FeaturesModalFilterState extends State<FeaturesModalFilter> {
1111

1212
String _car = '';
13-
List _smartphone = [];
13+
List<String> _smartphone = [];
1414

1515
@override
1616
Widget build(BuildContext context) {
1717
return Column(
1818
children: <Widget>[
1919
Container(height: 7),
20-
SmartSelect.single(
20+
SmartSelect<String>.single(
2121
title: 'Car',
2222
placeholder: 'Choose one',
2323
value: _car,
2424
isTwoLine: true,
25-
options: SmartSelectOption.listFrom<Map, String>(
25+
options: SmartSelectOption.listFrom<String, Map>(
2626
source: options.cars,
2727
value: (index, item) => item['value'],
2828
title: (index, item) => item['title'],
@@ -36,12 +36,12 @@ class _FeaturesModalFilterState extends State<FeaturesModalFilter> {
3636
onChange: (val) => setState(() => _car = val),
3737
),
3838
Divider(indent: 20),
39-
SmartSelect.multiple(
39+
SmartSelect<String>.multiple(
4040
title: 'Smartphones',
4141
placeholder: 'Choose one',
4242
value: _smartphone,
4343
isTwoLine: true,
44-
options: SmartSelectOption.listFrom<Map, String>(
44+
options: SmartSelectOption.listFrom<String, Map>(
4545
source: options.smartphones,
4646
value: (index, item) => item['id'],
4747
title: (index, item) => item['name'],

example/lib/features_modal/modal_header.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ class FeaturesModalHeader extends StatefulWidget {
1010

1111
class _FeaturesModalHeaderState extends State<FeaturesModalHeader> {
1212

13-
List _month = ['apr'];
13+
List<String> _month = ['apr'];
1414
String _framework = 'flu';
15-
List _hero = ['bat', 'spi'];
15+
List<String> _hero = ['bat', 'spi'];
1616

1717
@override
1818
Widget build(BuildContext context) {
1919
return Column(
2020
children: <Widget>[
2121
Container(height: 7),
22-
SmartSelect.multiple(
22+
SmartSelect<String>.multiple(
2323
title: 'Month',
2424
value: _month,
2525
isTwoLine: true,
@@ -42,7 +42,7 @@ class _FeaturesModalHeaderState extends State<FeaturesModalHeader> {
4242
onChange: (val) => setState(() => _month = val)
4343
),
4444
Divider(indent: 20),
45-
SmartSelect.single(
45+
SmartSelect<String>.single(
4646
title: 'Frameworks',
4747
value: _framework,
4848
options: options.frameworks,
@@ -64,7 +64,7 @@ class _FeaturesModalHeaderState extends State<FeaturesModalHeader> {
6464
onChange: (val) => setState(() => _framework = val),
6565
),
6666
Divider(indent: 20),
67-
SmartSelect.multiple(
67+
SmartSelect<String>.multiple(
6868
title: 'Super Hero',
6969
value: _hero,
7070
isTwoLine: true,

example/lib/features_modal/modal_headerless.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ class FeaturesModalHeaderless extends StatefulWidget {
99

1010
class _FeaturesModalHeaderlessState extends State<FeaturesModalHeaderless> {
1111

12-
List _fruit = ['mel'];
13-
List _hero = ['bat', 'spi'];
12+
List<String> _fruit = ['mel'];
13+
List<String> _hero = ['bat', 'spi'];
1414

1515
@override
1616
Widget build(BuildContext context) {
1717
return Column(
1818
children: <Widget>[
1919
Container(height: 7),
20-
SmartSelect.multiple(
20+
SmartSelect<String>.multiple(
2121
title: 'Fruit',
2222
value: _fruit,
2323
isTwoLine: true,
@@ -34,7 +34,7 @@ class _FeaturesModalHeaderlessState extends State<FeaturesModalHeaderless> {
3434
onChange: (val) => setState(() => _fruit = val),
3535
),
3636
Divider(indent: 20),
37-
SmartSelect.multiple(
37+
SmartSelect<String>.multiple(
3838
title: 'Super Hero',
3939
value: _hero,
4040
isTwoLine: true,

0 commit comments

Comments
 (0)