-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support disabled and hidden option, etc
- Loading branch information
1 parent
6478491
commit e0b918d
Showing
18 changed files
with
550 additions
and
309 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:smart_select/smart_select.dart'; | ||
|
||
class FeaturesOptionDisabled extends StatefulWidget { | ||
@override | ||
_FeaturesOptionDisabledState createState() => _FeaturesOptionDisabledState(); | ||
} | ||
|
||
class _FeaturesOptionDisabledState extends State<FeaturesOptionDisabled> { | ||
|
||
List _categories = []; | ||
|
||
int _sort = 0; | ||
|
||
List<String> _categoriesOption = [ | ||
'Electronics', 'Accessories', 'Smartwatch', | ||
'Smartphone', 'Audio & Video', 'Scientific' | ||
]; | ||
|
||
List<String> _sortOption = [ | ||
'Popular', 'Most Reviews', 'Newest', | ||
'Low Price', 'High Price', | ||
]; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
children: <Widget>[ | ||
Container(height: 7), | ||
Card( | ||
elevation: 3, | ||
margin: EdgeInsets.all(10), | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(5.0), | ||
), | ||
child: Row( | ||
children: <Widget>[ | ||
Expanded( | ||
child: SmartSelect.multiple( | ||
title: 'Categories', | ||
value: _categories, | ||
isTwoLine: true, | ||
trailing: Icon(Icons.arrow_drop_down), | ||
options: SmartSelectOption.listFrom<String, int>( | ||
source: _categoriesOption, | ||
value: (index, item) => index, | ||
title: (index, item) => item, | ||
disabled: (index, item) => [0, 2, 5].contains(index), | ||
), | ||
choiceType: SmartSelectChoiceType.switches, | ||
modalType: SmartSelectModalType.popupDialog, | ||
modalConfig: SmartSelectModalConfig( | ||
useHeader: false, | ||
), | ||
onChange: (val) => setState(() => _categories = val), | ||
), | ||
), | ||
Container( | ||
height: 40, | ||
child: VerticalDivider(), | ||
), | ||
Expanded( | ||
child: SmartSelect.single( | ||
title: 'Sort By', | ||
value: _sort, | ||
isTwoLine: true, | ||
trailing: Icon(Icons.arrow_drop_down), | ||
options: SmartSelectOption.listFrom<String, int>( | ||
source: _sortOption, | ||
value: (index, item) => index, | ||
title: (index, item) => item, | ||
disabled: (index, item) => item.toLowerCase().contains('price'), | ||
), | ||
modalType: SmartSelectModalType.popupDialog, | ||
modalConfig: SmartSelectModalConfig( | ||
useHeader: false, | ||
), | ||
onChange: (val) => setState(() => _sort = val), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
Container(height: 7), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:smart_select/smart_select.dart'; | ||
|
||
class FeaturesOptionHidden extends StatefulWidget { | ||
@override | ||
_FeaturesOptionHiddenState createState() => _FeaturesOptionHiddenState(); | ||
} | ||
|
||
class _FeaturesOptionHiddenState extends State<FeaturesOptionHidden> { | ||
|
||
List _categories = []; | ||
|
||
int _sort = 0; | ||
|
||
List<String> _categoriesOption = [ | ||
'Electronics', 'Accessories', 'Smartwatch', | ||
'Smartphone', 'Audio & Video', 'Scientific' | ||
]; | ||
|
||
List<String> _sortOption = [ | ||
'Popular', 'Most Reviews', 'Newest', | ||
'Low Price', 'High Price', | ||
]; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Column( | ||
children: <Widget>[ | ||
Container(height: 7), | ||
Card( | ||
elevation: 3, | ||
margin: EdgeInsets.all(10), | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(5.0), | ||
), | ||
child: Row( | ||
children: <Widget>[ | ||
Expanded( | ||
child: SmartSelect.multiple( | ||
title: 'Categories', | ||
value: _categories, | ||
isTwoLine: true, | ||
trailing: Icon(Icons.arrow_drop_down), | ||
options: SmartSelectOption.listFrom<String, int>( | ||
source: _categoriesOption, | ||
value: (index, item) => index, | ||
title: (index, item) => item, | ||
hidden: (index, item) => [0, 2, 5].contains(index), | ||
), | ||
choiceType: SmartSelectChoiceType.switches, | ||
modalType: SmartSelectModalType.popupDialog, | ||
modalConfig: SmartSelectModalConfig( | ||
useHeader: false, | ||
), | ||
onChange: (val) => setState(() => _categories = val), | ||
), | ||
), | ||
Container( | ||
height: 40, | ||
child: VerticalDivider(), | ||
), | ||
Expanded( | ||
child: SmartSelect.single( | ||
title: 'Sort By', | ||
value: _sort, | ||
isTwoLine: true, | ||
trailing: Icon(Icons.arrow_drop_down), | ||
options: SmartSelectOption.listFrom<String, int>( | ||
source: _sortOption, | ||
value: (index, item) => index, | ||
title: (index, item) => item, | ||
hidden: (index, item) => item.toLowerCase().contains('price'), | ||
), | ||
modalType: SmartSelectModalType.popupDialog, | ||
modalConfig: SmartSelectModalConfig( | ||
useHeader: false, | ||
), | ||
onChange: (val) => setState(() => _sort = val), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
Container(height: 7), | ||
], | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.