canonical / ubuntu-flutter-plugins

A collection of Flutter plugins and packages for Ubuntu applications.
49 stars 12 forks source link

wizard_router : back function does not load previous route in routes if not already loaded in state. #432

Closed WilliamMrc closed 1 month ago

WilliamMrc commented 1 month ago

Steps to reproduce :

code exploration :

back function search for previous route in routes. If the previous route is not found in state, state.lastIndexWhere((settings) => settings.name == previous) returns -1 and the route at index 0 of state is loaded.

Solution proposition :

if route is not in state, call _loadRoute and place it before current route in state.

I can try to resolve it with a PR if you think it's a good solution.

WilliamMrc commented 1 month ago

I can see from other part of the controller that this behavior is intentional. another solution is to add a previous() function that explicitly navigate to previous route in wizard. Is it a better solution ?

spydon commented 1 month ago

@WilliamMrc I guess back means more like pop:ing, than going to the route before the current one. A previous method could work!

WilliamMrc commented 1 month ago

@spydon thanks for the feed back. please tell me if my PR #433 is ok for you.