onboarding_overlay
onboarding_overlay copied to clipboard
How to wait for the page widgets to load?
Hi, I'm using this library on the home screen of an app. The homescreen has some widgets that get loaded dynamically based on what's fetched on the server.
Each home widget has the following build logic:
@override
Widget build(BuildContext context, WidgetRef ref) {
if (qod == null) {
return const SizedBox();
}
//return the actual widget
}
If I wrap this whole widget into a Focus node, I get only a tiny dot highlighted (which probably corresponds to the empty SizedBox(). If I wrap only the actual box, I get the grey overlay without any highlight at all.
I guess this happens because at the time the Onboarding widget is initialized, the focusnodes are wrapping something that either will change (SizedBox) or doesn't exists yet (the actual widget).
How can I solve this problem?
I tried to call the show() function after a delay, but nothing has changed:
@override
void initState() {
super.initState();
Future.delayed(const Duration(milliseconds: 500), () {
final OnboardingState? onboarding = Onboarding.of(context);
if (onboarding != null) {
onboarding.show();
}
});
}
Did you ever find a solution? I'm having a similar problem.