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/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_modular/flutter_modular.dart'; import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_core/core.dart';
import '../blocs/emergency_contact_bloc.dart'; import '../blocs/emergency_contact_bloc.dart';
import '../widgets/emergency_contact_add_button.dart'; import '../widgets/emergency_contact_add_button.dart';
import '../widgets/emergency_contact_form_item.dart'; import '../widgets/emergency_contact_form_item.dart';
@@ -22,22 +22,11 @@ class EmergencyContactScreen extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
Translations.of(context); // Force rebuild on locale change Translations.of(context); // Force rebuild on locale change
return Scaffold( return Scaffold(
appBar: AppBar( appBar: UiAppBar(
elevation: 0, title: 'Emergency Contact',
leading: IconButton( showBackButton: true,
icon: const Icon(UiIcons.chevronLeft, color: UiColors.textSecondary),
onPressed: () => Modular.to.popSafe(),
),
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>(), create: (context) => Modular.get<EmergencyContactBloc>(),
child: BlocConsumer<EmergencyContactBloc, EmergencyContactState>( child: BlocConsumer<EmergencyContactBloc, EmergencyContactState>(
listener: (context, state) { listener: (context, state) {

View File

@@ -6,16 +6,9 @@ class EmergencyContactInfoBanner extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return UiNoticeBanner(
padding: const EdgeInsets.all(UiConstants.space4), title:
decoration: BoxDecoration( 'Please provide at least one emergency contact. This information will only be used in case of an emergency during your shifts.',
color: UiColors.accent.withValues(alpha: 0.2),
borderRadius: UiConstants.radiusLg,
),
child: Text(
'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( child: Scaffold(
backgroundColor: UiColors.background, appBar: UiAppBar(
appBar: AppBar( title: i18n.title,
backgroundColor: UiColors.bgPopup, showBackButton: true,
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),
),
), ),
body: SafeArea( body: SafeArea(
child: BlocBuilder<PersonalInfoBloc, PersonalInfoState>( child: BlocBuilder<PersonalInfoBloc, PersonalInfoState>(

View File

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