talamaska / onboarding_overlay

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[question] Execute code after Onboarding.of(context)!.show();

Macacoazul01 opened this issue · comments

Today if i try to execute something on the next line after Onboarding.of(context)!.show() it will run before the end of the onboarding steps.

Is there any way of "waiting" the end of onboarding steps to execute the code (something like this function becoming async) or the only way is adding some function to onTapCallback of the last OnboardingStep widget?

the Onboarding widget has a callback onEnd, which is called after the last step

Can you give any sample on how to use it?

Onboarding(
  key: onboardingKey,
  steps: getSteps(al, theme, focusNodes),
  autoSizeTexts: true,
  onEnd: (int index) {
    onboardingStore.updateOnboardingCompleted(true); // MobX, Store, ChangeNotifier, Cubit w/e 
  },
  globalOnboarding: true,
  child: Scaffold(...)
)

Tks
It worked!!