Open radzish opened 1 year ago
I made simple example without using go_router and all works as expected.
@radzish Could you provide this sample code so that we may verify this?
@huycozy, see code without go_router below:
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyPage(),
);
}
}
class MyPage extends StatelessWidget {
const MyPage({super.key});
@override
Widget build(BuildContext context) {
return Center(
child: TextButton(
onPressed: () {
showDialog(
context: context,
builder: (_) {
return Center(child: Container(width: 300, height: 200, color: Colors.green));
},
);
},
child: Text('open'),
),
);
}
}
@radzish thanks for providing this sample code. This issue is reproducible on the latest stable
and master
channels with go_router: ^5.0.5
.
Labeling this issue for further insight from the team!
I would like to say that the GoRouter.of(this).pop()
can't dismiss a dialog too, in mobile it navigates to the previous page, and if you are in the root route it throws an error saying there are no parent routes to pop to. I believe this is related.
the browser backbutton is a deeplink to a sepecific previous url, so I think this is working as Intended, the GoRouter.of(this).pop() is a different story though, that is a bug we should fix
I had the same problem
Same problem here
the browser backbutton is a deeplink to a sepecific previous url, so I think this is working as Intended, the GoRouter.of(this).pop() is a different story though, that is a bug we should fix
Hi, any update please on GoRouter.of(this).pop() Is this being tracked in some other issue.
Hi! I faced the same behavior with Drawer. On Android when system back button pressed, GoRouter removes last page from pages stack instead of closing Drawer. Moreover, Navigator.of(ctx).pop() works as expected and closes drawer, but context.pop() - just popping page from the stack. I think this issues are related. Are there any updates? Small update: When Android system back button pressed: If the stack is empty (couldn't pop anymore), then Drawer closes as expected.
Same issue, context.pop() cant dismiss dialog, only use Navigator.of(context).pop()
Damn, same issue with my showDialog(useRootNavigator: true), I need useRootNavigator: true because I need the complete screen size, not just the remaining screen where the dialog is a child widget.
Same issue is reproducing for me on a web application.
Same issue here. On web, I'd expect it to go to the previous page. On Android, however, I wouldn't consider this "working as intended". Dialogs should always be dismissible on Android with the back button.
(Flutter WEB) Does anyone have any idea how to fetch the showDialog() pop-up from Navigator/GoRouter, and close it on browser back button press? This issue wont be fixed any time soon, its P5 and there are 5k+ issue in the backlog.
Same issue. Any update please?
(Flutter WEB) Does anyone have any idea how to fetch the showDialog() pop-up from Navigator/GoRouter, and close it on browser back button press? This issue wont be fixed any time soon, its P5 and there are 5k+ issue in the backlog.
Hi @xaoo !
Did you try BackButtonListener with dialog? I used it with Overlay and it works well. In my case Overlay pushes to the next page and I had to check if current page is in focus.
Unfortunately I'm not familiar with browser flutter development. But hope, this will work.
(Flutter WEB) Does anyone have any idea how to fetch the showDialog() pop-up from Navigator/GoRouter, and close it on browser back button press? This issue wont be fixed any time soon, its P5 and there are 5k+ issue in the backlog.
Hi @xaoo !
Did you try BackButtonListener with dialog? I used it with Overlay and it works well. In my case Overlay pushes to the next page and I had to check if current page is in focus.
Unfortunately I'm not familiar with browser flutter development. But hope, this will work.
I tried, it didn’t work. read what is written here: https://github.com/flutter/flutter/issues/71122#issuecomment-733864359
Hi there, you should opening dialog or bottom sheet with go router, like above code:
/// Call the method GoRouter.of(context).push("dialog");
/// Write in routes part. GoRoute( path: "dialog", builder: (context, state) => DialogPage( child: SampleDialogWidget(), ), ),
/// This is a for Dialog
class DialogPage
const DialogPage({ required this.child, this.anchorPoint, this.barrierColor = Colors.transparent, this.barrierDismissible = true, this.barrierLabel, this.useSafeArea = true, this.themes, super.key, super.name, super.arguments, super.restorationId, });
@override
Route
/// This is for BottomSheet
class BottomSheet
const BottomSheet({ required this.child, this.anchorPoint, this.barrierColor = Colors.transparent, this.barrierDismissible = true, this.barrierLabel, this.useSafeArea = true, this.isScrollControlled = false, this.themes, super.key, super.name, super.arguments, super.restorationId, });
@override
Route
+1
See following code:
Steps to reproduce:
I made simple example without using go_router and all works as expected.
go_router version: 5.0.1