Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Wizard.of(context).next() for the last route as well? #323

Open
s0nerik opened this issue Sep 1, 2023 · 2 comments
Open

Allow Wizard.of(context).next() for the last route as well? #323

s0nerik opened this issue Sep 1, 2023 · 2 comments

Comments

@s0nerik
Copy link

s0nerik commented Sep 1, 2023

I have the following wizard setup, which looks quite natural to me and doesn't require the ConfirmAuthPage to do anything with GoRouter (thus, it can be safely moved around without any fear of breaking the flow):

  @override
  Widget build(BuildContext context) {
    return Wizard(
      routes: {
        '/request':
            WizardRoute(builder: (_) => const RequestAuthPage()),
        '/confirm': WizardRoute(
          builder: (_) => const ConfirmAuthPage(),
          onNext: (_) {
            GoRouter.of(context).pop();
            return null;
          },
        ),
      },
    );
  }

The problem is that Wizard doesn't let me call next() from within the ConfirmAuthPage, which seems to leave me no choice other than introducing GoRouter routing right into the ConfirmAuthPage, which I'd want to avoid.

What do you think about adding an option to allow next() on the last page of the flow or even allowing it unconditionally (doing nothing if there's no next page in the flow)?

@andyhorn
Copy link

I would also like to have onNext not throw an error on the last page or add an onComplete callback 👍

@spydon
Copy link
Collaborator

spydon commented Oct 30, 2024

An onConplete callback sounds like a good idea, do you want to put up a PR for this @andyhorn?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants