In general, go_router is used to navigate from one page to another page. The page that we navigated will show in front of the previous page. But how to implement this inside of showModalBottomSheet?
I have a modal that show only half screen. Then, when i click button where navigate to the new page, the page is show in front of the modal. But what i want is the new page still showing inside half modal.
2
Answers
The go_router package is a package used to facilitate page management in Flutter applications. The showModalBottomSheet function is used to open subpages. You can follow these steps to open two showModalBottomSheets, nested one after another.
If you are delivering simple enough pages within the
ModalBottomSheet
then consider using aboolean
value to control which page gets rendered. There is no need to spice things up.Otherwise, if you have a sub-complex tree under your
ModalBottomSheet
, e.g >3 screens with layers of page. Try to define it explicitly as a new tree and assign it toshowModalBottomSheet's builder
, then it will be built using the modal’scontext
, hence not trying to extend the whole screen size.