From 0e31a3ea96bd78e2f295083d638cdf5937f5ed94 Mon Sep 17 00:00:00 2001 From: raf-dev1 Date: Tue, 10 Jun 2025 16:33:33 +0300 Subject: [PATCH] no need to fetch use info in init state of homepage and agreement dialog --- lib/pages/home/view/home_page_web.dart | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/pages/home/view/home_page_web.dart b/lib/pages/home/view/home_page_web.dart index 9a59f51c..a7a0eee4 100644 --- a/lib/pages/home/view/home_page_web.dart +++ b/lib/pages/home/view/home_page_web.dart @@ -24,7 +24,7 @@ class _HomeWebPageState extends State { void initState() { super.initState(); final homeBloc = BlocProvider.of(context); - homeBloc.add(const FetchUserInfo()); + // homeBloc.add(const FetchUserInfo()); } @override @@ -38,8 +38,10 @@ class _HomeWebPageState extends State { child: BlocConsumer( listener: (BuildContext context, state) { if (state is HomeInitial) { - if (homeBloc.user!.hasAcceptedWebAgreement == false && !_dialogShown) { - _dialogShown = true; // Set the flag to true to indicate the dialog is showing. + if (homeBloc.user!.hasAcceptedWebAgreement == false && + !_dialogShown) { + _dialogShown = + true; // Set the flag to true to indicate the dialog is showing. Future.delayed(const Duration(seconds: 1), () { showDialog( context: context, @@ -54,7 +56,7 @@ class _HomeWebPageState extends State { _dialogShown = false; if (v != null) { homeBloc.add(ConfirmUserAgreementEvent()); - homeBloc.add(const FetchUserInfo()); + // homeBloc.add(const FetchUserInfo()); } }); }); @@ -98,7 +100,8 @@ class _HomeWebPageState extends State { width: size.width * 0.68, child: GridView.builder( itemCount: homeBloc.homeItems.length, - gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, // Adjust as needed. crossAxisSpacing: 20.0, mainAxisSpacing: 20.0, @@ -110,7 +113,8 @@ class _HomeWebPageState extends State { active: homeBloc.homeItems[index].active!, name: homeBloc.homeItems[index].title!, img: homeBloc.homeItems[index].icon!, - onTap: () => homeBloc.homeItems[index].onPress(context), + onTap: () => + homeBloc.homeItems[index].onPress(context), ); }, ),