How can I use GetView and GetWidget with their bindings using an indexed stack

Viewed 24

so I'm using Getx package, I'm using GetView and GetWidget instead of StatelessWidget so it finds the controllers I bind to them from a separate bindings file I want without the boilerplate of writing Get.find<T>(); for each screen.

the package was made so that the bindings will actually work when using route managers like Get.to(), Get.of()...

in my case I'm using Indexed Stack to show those views, here is a sample :

IndexedStack(
        index: currentScreenIndex,
        children: <Widget>[
          ScreenExample(),
          ScreenExample()
          ScreenExample()
          ScreenExample()
        ])

when navigating between those indexed screens we're not opening/closing pages, we just navigate between them, so the bindings don't actually work for each screen

I want that when navigating in those screens, the bindings work like if we use Get.to()... so the bindings actually work normally, I want to still use GetView and GetWidget so extending just StatelessWidget and writing Get.put() for each page is not possible because I have too many pages

Thanks

Thanks

1 Answers

documentation:

Indexed Stack : A Stack that shows a single child from a list of children.

The screen will not navigated, IndexedStack will change the children based on index selected.

if you want to bind and navigate the screen, dont use indexedstack

Related