Flutterando / modular

A smart project structure
https://pub.dev/packages/flutter_modular
Other
1.31k stars 254 forks source link

How to use Modular to navigate to a BottomSheet or Dialog? #730

Closed rhbrunetto closed 1 year ago

rhbrunetto commented 2 years ago

Following the #598 issue, there's a limitation in the most recent versions of Modular where you can't specify a RouteBuilder in ChildRoutes. I decided to turn my last comment into an issue so we can enlighten the situation.

Questions

How should we supposed to navigate to a page (for instance, in another Module) and tell Modular to build it as a BottomSheet or as a Dialog instead of a default MaterialPage?

Expected Behavior

For instance, I'd like to create MyScreen (a simple widget) and navigate to it through a route (let's say Modular.to.navigate('/my-screen/')) and make it shows up as a BottomSheet or as a FullScreenDialog. This was possible via routeGenerator parameter that have been removed in the recent versions of Modular.

Arguments

This is particular useful so we can use the Modular Route system to dialogs, bottomsheets and similars. And: 1 - Set a standard of how navigation works in your app (using Modular-only); 2 - Use Bottomsheets/modals as Module roots.

Btw, I do appreciate the job you guys are doing with Modular! Let us help to resolve such limitations.

guigzp commented 2 years ago

Seems like it would be a nice a improvement, any updates on this?

Zeca-dev commented 2 years ago

Seria muito bom ter esse recurso. Faz muita falta. Quando usamos o Modular.to para navegar, o módulo da page é iniciado. Mas se instanciamoos um PageRouter para navegar como modal, como quermosl, o módulo não será iniciado e então teremos problemas com a injeção de depedências.

rhbrunetto commented 2 years ago

@jacobaraujo7 how can we help on this? Should we submit a new PR following similar changes from #598? Should we propose a different solution?

vscmaster commented 1 year ago

Hi there is it any updates regarding routeGenerator? Our App designed to use BottomSheet via routeGenerator and we unable to upgrade Modular since 2.7v. We have tens of BS implementations so it's not serious to break the initial UAX at all.

Thank you

andersonmendesdev commented 1 year ago

I'm interested in this feature, my team and I were thinking of developing the next project using modular and it would be of great importance to be able to customize the types of screens as well as dialogs and bottomsheet. Why was the routeGenerator removed, if it was a good way to generate screen types?

gibahjoe commented 1 year ago

Maybe the maintainer can enlighten us to why it was removed.

jacobaraujo7 commented 1 year ago

RouterGenerator is no longer used as we are working with Navigator 2.0