Skip to content

Commit 3f78dae

Browse files
author
caven775
committed
标识flutterDialog
1 parent 5d82077 commit 3f78dae

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

example/lib/test_case.dart

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,5 +373,48 @@ class TestCase {
373373
DStack.popTo("page2", PageType.flutter);
374374
}
375375
},
376+
{
377+
"text": "打开dialog",
378+
"clicked": (context) {
379+
showDialog(
380+
context: context,
381+
barrierDismissible: false,
382+
builder: (BuildContext cxt) {
383+
return Container(
384+
alignment: Alignment.center,
385+
child: GestureDetector(
386+
child: Container(
387+
width: 300,
388+
height: 240,
389+
color: Colors.white,
390+
child: Column(
391+
mainAxisAlignment: MainAxisAlignment.center,
392+
children: [
393+
Text("dialog",
394+
style: TextStyle(decoration: TextDecoration.none)),
395+
RaisedButton(
396+
onPressed: () {
397+
DStack.push('page3', PageType.flutter);
398+
},
399+
child: Text("进入下一页面",
400+
style:
401+
TextStyle(decoration: TextDecoration.none)),
402+
),
403+
RaisedButton(
404+
onPressed: () {
405+
Navigator.pop(cxt);
406+
},
407+
child: Text("关闭弹窗",
408+
style:
409+
TextStyle(decoration: TextDecoration.none)),
410+
)
411+
],
412+
),
413+
),
414+
),
415+
);
416+
});
417+
}
418+
},
376419
];
377420
}

lib/constant/constant_config.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ class DStackConstant {
3131

3232
/// 其他标识
3333
static const String nativeDidPopGesture = "nativeDidPopGesture";
34+
static const String flutterDialog = "flutterDialog";
3435
}

lib/navigator/dnavigator_gesture_observer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class DStackNavigatorObserver extends NavigatorObserver {
5151
if (route is PopupRoute) {
5252
/// dialog进栈
5353
DNavigatorManager.nodeHandle(
54-
route.runtimeType.toString(), PageType.flutter, DStackConstant.push,
54+
DStackConstant.flutterDialog, PageType.flutter, DStackConstant.push,
5555
route: route);
5656
}
5757
}
@@ -65,7 +65,7 @@ class DStackNavigatorObserver extends NavigatorObserver {
6565
routerCount -= 1;
6666
if (route is PopupRoute) {
6767
/// dialog出栈
68-
DNavigatorManager.removeFlutterNode(route.runtimeType.toString(),
68+
DNavigatorManager.removeFlutterNode(DStackConstant.flutterDialog,
6969
identifier: DNavigatorManager.identifierWithRoute(route));
7070
} else {
7171
debugPrint(

0 commit comments

Comments
 (0)