refactor: Rearrange MultiBlocProvider and Scaffold structure in ClockInPage for improved readability

This commit is contained in:
Achintha Isuru
2026-03-13 17:15:44 -04:00
parent a85cd36975
commit ea078eaa02

View File

@@ -25,29 +25,25 @@ class ClockInPage extends StatelessWidget {
context,
).staff.clock_in;
return MultiBlocProvider(
providers: <BlocProvider<dynamic>>[
BlocProvider<ClockInBloc>.value(
value: Modular.get<ClockInBloc>(),
),
BlocProvider<GeofenceBloc>.value(
value: Modular.get<GeofenceBloc>(),
),
],
child: BlocListener<ClockInBloc, ClockInState>(
listenWhen: (ClockInState previous, ClockInState current) =>
current.status == ClockInStatus.failure &&
current.errorMessage != null,
listener: (BuildContext context, ClockInState state) {
UiSnackbar.show(
context,
message: translateErrorKey(state.errorMessage!),
type: UiSnackbarType.error,
);
},
child: Scaffold(
appBar: UiAppBar(title: i18n.title, showBackButton: false),
body: BlocBuilder<ClockInBloc, ClockInState>(
return Scaffold(
appBar: UiAppBar(title: i18n.title, showBackButton: false),
body: MultiBlocProvider(
providers: <BlocProvider<dynamic>>[
BlocProvider<ClockInBloc>.value(value: Modular.get<ClockInBloc>()),
BlocProvider<GeofenceBloc>.value(value: Modular.get<GeofenceBloc>()),
],
child: BlocListener<ClockInBloc, ClockInState>(
listenWhen: (ClockInState previous, ClockInState current) =>
current.status == ClockInStatus.failure &&
current.errorMessage != null,
listener: (BuildContext context, ClockInState state) {
UiSnackbar.show(
context,
message: translateErrorKey(state.errorMessage!),
type: UiSnackbarType.error,
);
},
child: BlocBuilder<ClockInBloc, ClockInState>(
buildWhen: (ClockInState previous, ClockInState current) =>
previous.status != current.status ||
previous.todayShifts != current.todayShifts,