Skip to content

Commit

Permalink
updated code and fixed health issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Harpreet Singh authored and Harpreet Singh committed Apr 29, 2020
1 parent f6d6bbe commit 0472881
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 39 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.0.2] - Release

* Fixed Health issues

## [0.0.1] - Release

* Customizable account selection modal bottom sheet widgets
Expand Down
5 changes: 2 additions & 3 deletions example/lib/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@ class _HomeScreenWidgetState extends State<HomeScreenWidget> {
selectedRadioColor: Colors.amber, //Optional
unselectedTextColor: Colors.white, //Optional
selectedTextColor: Colors.amber, //Optional
//Optional
//Optional
tapCallback: (index) {

setState(() {
resultText =
"selected account is : ${accountList[index].title}";
});
print(resultText);
},
},
//Optional
addAccountTapCallback: () {
setState(() {
Expand Down
11 changes: 9 additions & 2 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.0.1"
version: "0.0.2"
archive:
dependency: transitive
description:
Expand Down Expand Up @@ -109,6 +109,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
Expand Down Expand Up @@ -169,7 +176,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
version: "0.2.11"
typed_data:
dependency: transitive
description:
Expand Down
6 changes: 2 additions & 4 deletions lib/account_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ showAccountSelectorSheet({
backgroundColor: Colors.transparent,
isDismissible: isSheetDismissible,
isScrollControlled: true,
enableDrag: true,
builder: (context) {
return SingleAccountSelectionWidget(
accountwithselectionList: accountwithselectionList,
Expand All @@ -57,7 +56,7 @@ showAccountSelectorSheet({
Future<List<int>> showMultiAccountSelectorSheet({
@required BuildContext context,
@required List<Account> accountList,
List<int> initiallySelectedIndexList ,
List<int> initiallySelectedIndexList,
Color checkedIconColor = Colors.green,
Color doneButtonColor = Colors.blue,
Color arrowColor = Colors.grey,
Expand All @@ -77,12 +76,11 @@ Future<List<int>> showMultiAccountSelectorSheet({
context: context,
backgroundColor: Colors.transparent,
isScrollControlled: true,
enableDrag: true,
isDismissible: isSheetDismissible,
builder: (context) {
return MultiAccountSelectionWidget(
accountwithselectionList: accountwithselectionList,
initiallySelectedIndexList: initiallySelectedIndexList??[-1],
initiallySelectedIndexList: initiallySelectedIndexList ?? [-1],
checkedIconColor: checkedIconColor,
doneText: doneText,
doneButtonColor: doneButtonColor,
Expand Down
11 changes: 8 additions & 3 deletions lib/selector_widget.dart/muti_account_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ class _MultiAccountSelectionWidgetState
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
icon: Icon(Icons.keyboard_arrow_down, color: widget.arrowColor),
icon: Icon(
Icons.keyboard_arrow_down,
color: widget.arrowColor,
),
onPressed: () {
Navigator.of(context).pop();
},
Expand All @@ -82,7 +85,9 @@ class _MultiAccountSelectionWidgetState
height: 56,
width: 56,
decoration: BoxDecoration(
shape: BoxShape.circle, color: Colors.grey[200]),
shape: BoxShape.circle,
color: Colors.grey[200],
),
child: widget.accountwithselectionList[index]
.accountImageWidget,
),
Expand Down Expand Up @@ -110,7 +115,7 @@ class _MultiAccountSelectionWidgetState
} else {
currentlySelectedIndexList.add(index);
}
},
},
);
},
),
Expand Down
54 changes: 29 additions & 25 deletions lib/selector_widget.dart/single_account_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ class _SingleAccountSelectionWidgetState
mainAxisSize: MainAxisSize.min,
children: <Widget>[
IconButton(
icon: Icon(Icons.keyboard_arrow_down, color: widget.arrowColor),
icon: Icon(
Icons.keyboard_arrow_down,
color: widget.arrowColor,
),
onPressed: () {
Navigator.of(context).pop();
},
Expand All @@ -72,7 +75,7 @@ class _SingleAccountSelectionWidgetState
maxWidth: double.maxFinite,
),
child: Padding(
padding: const EdgeInsets.only(bottom:16.0),
padding: const EdgeInsets.only(bottom: 16.0),
child: ListView.builder(
shrinkWrap: true,
physics: BouncingScrollPhysics(),
Expand All @@ -88,7 +91,8 @@ class _SingleAccountSelectionWidgetState
shape: BoxShape.circle,
color: Colors.grey[200]),
child: index ==
(widget.accountwithselectionList.length - 1)
(widget.accountwithselectionList.length -
1)
? CircleAvatar(
radius: 28,
backgroundColor: Colors.grey[200],
Expand All @@ -108,28 +112,28 @@ class _SingleAccountSelectionWidgetState
: widget.unselectedTextColor,
),
),
trailing:
index == (widget.accountwithselectionList.length - 1)
? Offstage()
: Icon(
(index == currentIndex)
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
color: (index == currentIndex)
? widget.selectedRadioColor
: widget.unselectedRadioColor),
onTap:
index == (widget.accountwithselectionList.length - 1)
? widget.addAccountTapCallback
: () {
setState(() {
currentIndex = index;
});
if (widget.hideSheetOnItemTap) {
Navigator.of(context).pop();
}
widget.tapCallback(index);
},
trailing: index ==
(widget.accountwithselectionList.length - 1)
? Offstage()
: Icon(
(index == currentIndex)
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
color: (index == currentIndex)
? widget.selectedRadioColor
: widget.unselectedRadioColor),
onTap: index ==
(widget.accountwithselectionList.length - 1)
? widget.addAccountTapCallback
: () {
setState(() {
currentIndex = index;
});
if (widget.hideSheetOnItemTap) {
Navigator.of(context).pop();
}
widget.tapCallback(index);
},
),
);
},
Expand Down
9 changes: 8 additions & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0+1"
petitparser:
dependency: transitive
description:
Expand Down Expand Up @@ -155,7 +162,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
version: "0.2.11"
typed_data:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: account_selector
description: A Flutter package which provides helper widgets for selecting single or multiple account/user from the given list.
version: 0.0.1
version: 0.0.2
author: Harpreet Seera <harpreetseera8525@gmail.com>
homepage: https://github.com/harpreetseera/flutter_account_selector

Expand Down

0 comments on commit 0472881

Please sign in to comment.