Skip to content

Commit 16dd4d0

Browse files
authored
Merge pull request best-flutter#4 from AonoCandal/master
fix issue best-flutter#3 列表项添加点击跳转到其他页面之后回来, 下拉菜单就不会弹出了
2 parents 4599c2c + 8f5f20e commit 16dd4d0

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lib/drapdown_common.dart

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import 'package:flutter/widgets.dart';
21
import 'package:flutter/foundation.dart';
2+
import 'package:flutter/widgets.dart';
33

44
enum DropdownEvent {
55
// the menu will hide
@@ -158,14 +158,16 @@ abstract class DropdownState<T extends DropdownWidget> extends State<T> {
158158

159159
@override
160160
void didChangeDependencies() {
161-
if (widget.controller == null) {
162-
controller = DefaultDropdownMenuController.of(context);
163-
} else {
164-
controller = widget.controller;
165-
}
161+
if (controller == null) {
162+
if (widget.controller == null) {
163+
controller = DefaultDropdownMenuController.of(context);
164+
} else {
165+
controller = widget.controller;
166+
}
166167

167-
if (controller != null) {
168-
controller.addListener(_onController);
168+
if (controller != null) {
169+
controller.addListener(_onController);
170+
}
169171
}
170172
super.didChangeDependencies();
171173
}

0 commit comments

Comments
 (0)