-
Notifications
You must be signed in to change notification settings - Fork 208
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
TargetFocus position is not stable. #159
Comments
Any update for this issue? |
Hi @dongnqda ! I'll look into it. |
Hi @RafaelBarbosatec I have a Widget called AppShell, where I call the show method. @override
void initState() {
context.read<AppCubit>().changePage(0);
Future.delayed(const Duration(seconds: 1), showOnboarding);
// WidgetsBinding.instance.addPostFrameCallback((_) => showOnboarding());
_listenUser();
super.initState();
}
void showOnboarding() {
if (widget.showOnboarding) {
AppOnboarding.instance.show(context: context);
}
}
@override
Widget build(BuildContext context) {
final cubit = context.read<AppCubit>();
return BlocBuilder<AppCubit, int>(
builder: (context, state) {
return Scaffold(
appBar: const CustomAppBar(),
body: widget.child,
resizeToAvoidBottomInset: false,
bottomNavigationBar: CustomBottomNavigation(
currentPage: context.watch<AppCubit>().state,
onTap: (index) => _onTapBottomItem(index, context),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
floatingActionButton: Align(
alignment: Alignment.bottomCenter,
heightFactor: 1.5,
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 4),
shape: BoxShape.circle,
),
child: FloatingActionButton(
onPressed: _onTapFloatingActionButton,
tooltip: AppLocalizations.current.newService,
child: Icon(cubit.isAddServicePage ? Icons.close : Icons.add),
),
),
),
);
},
);
} That is my widget that is rendered inside the scaffold. @override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
InfoCard(
key: AppOnboarding.stepOne,
title: NumberFormatHelper.formatCurrency(
context, state.totalWithDiscount),
subtitle: AppLocalizations.current.myBalance,
icon: AppAssets.services,
color: AppColors.green,
),
InfoCard(
key: AppOnboarding.stepTwo,
title: NumberFormatHelper.formatCurrency(
context, state.totalDiscounted),
subtitle: AppLocalizations.current.discounts,
icon: AppAssets.fire,
color: AppColors.orange,
),
InfoCard(
key: AppOnboarding.stepThree,
title: NumberFormatHelper.formatCurrency(context, state.totalValue),
subtitle: AppLocalizations.current.totalReceived,
icon: AppAssets.rocket,
color: AppColors.blue,
),
... That is the result: If I remove the AppBar, TargetFocus position are correct: |
Thanks for your example. |
The problem is that all TargetFocus are in the wrong position. And as I mentioned above, if I remove the AppBar the TargetFocus goes in the correct place. |
I also encountered the same issue when running the app tour inside WidgetsBinding.instance.addPostFrameCallback. Sometimes, the target focus does not display. My targets are enclosed within a BottomNavigationBar, which is further wrapped inside a BottomAppBar. |
Any updates on this? 🤔 |
Anyone can help me with this ? I have tried WidgetsBinding , Future.delay (Sometime showTutorial function doesn't get called, if I go back to previous screen, it's called)
The text was updated successfully, but these errors were encountered: