Skip to content

Commit 89d692a

Browse files
author
JZoom
committed
1.0.1
1 parent 9ffc304 commit 89d692a

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## [1.0.0] - [2018/05/25]
22
* Basic Usage
33

4-
4+
## [1.0.1] - [2018/05/25]
5+
* Fix index change bug when switchStyle=DropdownMenuShowHideSwitchStyle.directHideAnimationShow
6+
* Add index change swith animation style : DropdownMenuShowHideSwitchStyle.directHideDirectShow
57

68

79

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ A dropdown menu for Flutter.
1111

1212
```
1313
14-
dropdown_menu : ^1.0.0
14+
dropdown_menu : ^1.0.1
1515
1616
```
1717

example/lib/main.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ class _MyHomePageState extends State<MyHomePage> {
155155
height: maxHeight * 0.8.toDouble())
156156
],
157157
controller: controller,
158+
switchStyle: DropdownMenuShowHideSwitchStyle.directHideAnimationShow,
158159
child: new ListView(
159160
children:
160161
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((dynamic i) {

lib/dropdown_menu.dart

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ enum DropdownMenuShowHideSwitchStyle {
1414
/// the showing menu will direct hide without animation
1515
directHideAnimationShow,
1616

17+
/// the showing menu will direct hide without animation, and another menu shows without animation
18+
directHideDirectShow,
19+
1720
/// the showing menu will hide with animation,and the same time another menu shows with animation
1821
animationHideAnimationShow,
1922

@@ -300,7 +303,15 @@ class _DropdownMenuState extends State<DropdownMenu>
300303
switch (widget.switchStyle) {
301304
case DropdownMenuShowHideSwitchStyle.directHideAnimationShow:
302305
{
303-
_dropdownAnimations[index].value = 0.0;
306+
_dropdownAnimations[_activeIndex].value = 0.0;
307+
_dropdownAnimations[index].value = 1.0;
308+
_activeIndex = index;
309+
310+
setState(() {
311+
_show = true;
312+
});
313+
314+
return new Future.value(null);
304315
}
305316

306317
break;
@@ -309,21 +320,26 @@ class _DropdownMenuState extends State<DropdownMenu>
309320
_hide(_activeIndex);
310321
}
311322
break;
323+
case DropdownMenuShowHideSwitchStyle.directHideDirectShow:
324+
{
325+
_dropdownAnimations[_activeIndex].value = 0.0;
326+
}
327+
break;
312328
case DropdownMenuShowHideSwitchStyle
313329
.animationShowUntilAnimationHideComplete:
314330
{
315331
return _hide(_activeIndex).whenComplete(() {
316-
return _handleShow(index);
332+
return _handleShow(index,true);
317333
});
318334
}
319335
break;
320336
}
321337
}
322338

323-
return _handleShow(index);
339+
return _handleShow(index,true);
324340
}
325341

326-
TickerFuture _handleShow(int index) {
342+
TickerFuture _handleShow(int index,bool animation) {
327343
_activeIndex = index;
328344

329345
setState(() {

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: dropdown_menu
22
description: A dropdown menu for flutter.
3-
version: 1.0.0
3+
version: 1.0.1
44
author: JZoom <[email protected]>
55
homepage: https://github.com/jzoom/flutter_dropdown_menu
66

0 commit comments

Comments
 (0)