diff --git a/lib/presentation/pages/home/home_page.dart b/lib/presentation/pages/home/home_page.dart index d19d6eb..12f5a94 100644 --- a/lib/presentation/pages/home/home_page.dart +++ b/lib/presentation/pages/home/home_page.dart @@ -78,13 +78,21 @@ class _HomePageState extends State with TickerProviderStateMixin { super.dispose(); } + void _refetchDashboard(BuildContext context) { + context.read().add(HomeEvent.fetchedDashboard()); + } + @override Widget build(BuildContext context) { - return Scaffold( + return BlocListener( + listenWhen: (previous, current) => + previous.selectedOutletId != current.selectedOutletId, + listener: (context, state) => _refetchDashboard(context), + child: Scaffold( backgroundColor: AppColor.background, body: RefreshIndicator( onRefresh: () { - context.read().add(HomeEvent.fetchedDashboard()); + _refetchDashboard(context); return Future.value(); }, child: BlocBuilder( @@ -201,6 +209,7 @@ class _HomePageState extends State with TickerProviderStateMixin { }, ), ), - ); + ), // Scaffold + ); // BlocListener } }