feat: Refactor emergency contact screen and info banner for improved UI consistency

This commit is contained in:
Achintha Isuru
2026-03-01 02:16:26 -05:00
parent e05ca7c045
commit ea6b3fcc76
4 changed files with 12 additions and 44 deletions

View File

@@ -3,7 +3,7 @@ import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_core/core.dart';
import '../blocs/emergency_contact_bloc.dart';
import '../widgets/emergency_contact_add_button.dart';
import '../widgets/emergency_contact_form_item.dart';
@@ -22,22 +22,11 @@ class EmergencyContactScreen extends StatelessWidget {
Widget build(BuildContext context) {
Translations.of(context); // Force rebuild on locale change
return Scaffold(
appBar: AppBar(
elevation: 0,
leading: IconButton(
icon: const Icon(UiIcons.chevronLeft, color: UiColors.textSecondary),
onPressed: () => Modular.to.popSafe(),
appBar: UiAppBar(
title: 'Emergency Contact',
showBackButton: true,
),
title: Text(
'Emergency Contact',
style: UiTypography.title1m.textPrimary,
),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(1.0),
child: Container(color: UiColors.border, height: 1.0),
),
),
body: BlocProvider(
body: BlocProvider<EmergencyContactBloc>(
create: (context) => Modular.get<EmergencyContactBloc>(),
child: BlocConsumer<EmergencyContactBloc, EmergencyContactState>(
listener: (context, state) {

View File

@@ -6,16 +6,9 @@ class EmergencyContactInfoBanner extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(UiConstants.space4),
decoration: BoxDecoration(
color: UiColors.accent.withValues(alpha: 0.2),
borderRadius: UiConstants.radiusLg,
),
child: Text(
return UiNoticeBanner(
title:
'Please provide at least one emergency contact. This information will only be used in case of an emergency during your shifts.',
style: UiTypography.body2r.textPrimary,
),
);
}
}

View File

@@ -47,23 +47,9 @@ class PersonalInfoPage extends StatelessWidget {
}
},
child: Scaffold(
backgroundColor: UiColors.background,
appBar: AppBar(
backgroundColor: UiColors.bgPopup,
elevation: 0,
leading: IconButton(
icon: const Icon(
UiIcons.chevronLeft,
color: UiColors.textSecondary,
),
onPressed: () => Modular.to.popSafe(),
tooltip: MaterialLocalizations.of(context).backButtonTooltip,
),
title: Text(i18n.title, style: UiTypography.title1m.textPrimary),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(1.0),
child: Container(color: UiColors.border, height: 1.0),
),
appBar: UiAppBar(
title: i18n.title,
showBackButton: true,
),
body: SafeArea(
child: BlocBuilder<PersonalInfoBloc, PersonalInfoState>(

View File

@@ -294,7 +294,7 @@ class ShiftsBloc extends Bloc<ShiftsEvent, ShiftsState>
return shifts.where((shift) {
if (shift.date.isEmpty) return false;
try {
final shiftDate = DateTime.parse(shift.date);
final shiftDate = DateTime.parse(shift.date).toLocal();
final dateOnly = DateTime(
shiftDate.year,
shiftDate.month,