Closed kamami closed 4 months ago
I also believe it would be good, I still have this issue #90 regarding the Navigator 2.0 and couldn't find time unfortunately to fix it.
Just copy this file of the docs as a wrapper of your Page [SheetPage], change the cubit calls to a context.pop()
(https://github.com/woltapp/wolt_modal_sheet/blob/main/playground_navigator2/lib/router/router_pages/sheet_page.dart)
And inside your go_router routes you can put like this
GoRoute(
path: 'my_nice_sheet_path',
pageBuilder: (context, state) {
return SheetPage(
pageIndexNotifier: ValueNotifier(0),
pageListBuilderNotifier: ValueNotifier(
(context) => [
WoltModalSheetPage(child: const MyNiceSheet()),
],
),
);
},
);
If anyone still has a problem with this, I use the following solution:
I launch the sheet imperatively, but with 2 key points:
sheetContext
to childrenpop
, use context.pop()
from GoRouterThis also works if you need to use the root navigator to display the bottom sheet over a ShellRoute
(which was my main issue).
WoltModalSheet.show(
pageIndexNotifier: controller.sheetIndex,
context: context,
useRootNavigator: true,
pageListBuilder: (sheetContext) => [
],
onModalDismissedWithBarrierTap: () {
context.pop();
},
onModalDismissedWithDrag: () {
context.pop();
},
);
Hi @kamami ! We have a new example with Navigator 2.0.
I would appreciate if you can provide feedback about its complexity: https://github.com/woltapp/wolt_modal_sheet/tree/main/coffee_maker_navigator_2
Here is the video that explains it: https://drive.google.com/file/d/1vQOdEMUUNCj_XlEUaCil_kckctMz7JMu/view?usp=sharing
I'm not sure why this issue was closed. The author mentioned that example for Navigator 2.0 exists but not for GoRouter. I would also appreciate a working example with GoRouter, recently running into issues that Swipe-Back and Back-Button wouldn't pop the Modals.
I think it would be nice to have a basic example how to implement this package with go_router. I know there is a playground example with navigator 2.0, but it is very confusing and hard to follow.
Best Regards