felangel / flow_builder

Flutter Flows made easy! A Flutter package which simplifies navigation flows with a flexible, declarative API.
https://pub.dev/packages/flow_builder
MIT License
390 stars 64 forks source link

Is it possible to add an `onComplete` event to FlowBuilder? #5

Closed lijy91 closed 3 years ago

lijy91 commented 3 years ago

Is your feature request related to a problem? Please describe. Same as title

Describe the solution you'd like

FlowBuilder<RegisterFlowState>(
  state: RegisterFlowState(),
  onGeneratePages: (state) {
    return [
      MaterialPage<void>(child: RegisterSetNicknameSubPage()),
      if (state.shouldSetGender)
        MaterialPage<void>(child: RegisterSetGenderSubPage()),
    ];
  },
  onComplete: (state) {
    Navigator.of(context).pushReplacement(
      FadeInPageRoute(builder: (_) => HomePage()),
    );
  }
);

Describe alternatives you've considered None

Additional context If my current route is the root route, adding onComplete can help me go to the next page better

felangel commented 3 years ago

Hi @lijy91 👋 Thanks for opening an issue!

Definitely! I think that's a great idea and is being done as part of #6 👍

felangel commented 3 years ago

This is available as part of v0.0.1-dev.6 🎉

lijy91 commented 3 years ago

Great