Skip to content

Commit e7bb14c

Browse files
committed
fix dialog poping navigation stack leads to close browser on popping again bug try three
1 parent 17ff04e commit e7bb14c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/view/projects/components/project_media_widgets.dart

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,16 @@ class _ImageGalleryState extends State<ImageGallery> {
7777
onTap: () {
7878
showDialog(
7979
context: context,
80-
useRootNavigator: false,
81-
builder: (_) => ImageGalleryDialog(
82-
images: widget.images,
83-
initialIndex: widget.images.indexOf(displayImages[index]),
80+
builder: (_) => PopScope(
81+
canPop: false,
82+
onPopInvokedWithResult: (didPop, result) async {
83+
if (didPop) return;
84+
Navigator.of(context).pop();
85+
},
86+
child: ImageGalleryDialog(
87+
images: widget.images,
88+
initialIndex: widget.images.indexOf(displayImages[index]),
89+
),
8490
),
8591
);
8692
},

0 commit comments

Comments
 (0)