This commit is contained in:
efrilm 2026-05-13 15:31:14 +07:00
parent d7cd84e130
commit 6fda0f5636

View File

@ -78,13 +78,21 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
super.dispose();
}
void _refetchDashboard(BuildContext context) {
context.read<HomeBloc>().add(HomeEvent.fetchedDashboard());
}
@override
Widget build(BuildContext context) {
return Scaffold(
return BlocListener<SelectedOutletBloc, SelectedOutletState>(
listenWhen: (previous, current) =>
previous.selectedOutletId != current.selectedOutletId,
listener: (context, state) => _refetchDashboard(context),
child: Scaffold(
backgroundColor: AppColor.background,
body: RefreshIndicator(
onRefresh: () {
context.read<HomeBloc>().add(HomeEvent.fetchedDashboard());
_refetchDashboard(context);
return Future.value();
},
child: BlocBuilder<HomeBloc, HomeState>(
@ -201,6 +209,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
},
),
),
);
), // Scaffold
); // BlocListener
}
}