Fix build errors: localization syntax, key paths, and ViewOrderCard widget

This commit is contained in:
2026-02-14 16:26:10 +05:30
parent 097481d26a
commit 4e1a41ebff
25 changed files with 420 additions and 207 deletions

View File

@@ -105,12 +105,12 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('Accept Shift'),
content: const Text('Are you sure you want to accept this shift?'),
title: Text(t.staff_shifts.my_shifts_tab.confirm_dialog.title),
content: Text(t.staff_shifts.my_shifts_tab.confirm_dialog.message),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Cancel'),
child: Text(t.common.cancel),
),
TextButton(
onPressed: () {
@@ -118,14 +118,14 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
context.read<ShiftsBloc>().add(AcceptShiftEvent(id));
UiSnackbar.show(
context,
message: 'Shift confirmed!',
message: t.staff_shifts.my_shifts_tab.confirm_dialog.success,
type: UiSnackbarType.success,
);
},
style: TextButton.styleFrom(
foregroundColor: UiColors.success,
),
child: const Text('Accept'),
child: Text(t.staff_shifts.shift_details.accept_shift),
),
],
),
@@ -136,14 +136,14 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('Decline Shift'),
content: const Text(
'Are you sure you want to decline this shift? This action cannot be undone.',
title: Text(t.staff_shifts.my_shifts_tab.decline_dialog.title),
content: Text(
t.staff_shifts.my_shifts_tab.decline_dialog.message,
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Cancel'),
child: Text(t.common.cancel),
),
TextButton(
onPressed: () {
@@ -151,14 +151,14 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
context.read<ShiftsBloc>().add(DeclineShiftEvent(id));
UiSnackbar.show(
context,
message: 'Shift declined.',
message: t.staff_shifts.my_shifts_tab.decline_dialog.success,
type: UiSnackbarType.error,
);
},
style: TextButton.styleFrom(
foregroundColor: UiColors.destructive,
),
child: const Text('Decline'),
child: Text(t.staff_shifts.shift_details.decline),
),
],
),
@@ -169,9 +169,9 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
try {
final date = DateTime.parse(dateStr);
final now = DateTime.now();
if (_isSameDay(date, now)) return "Today";
if (_isSameDay(date, now)) return t.staff_shifts.my_shifts_tab.date.today;
final tomorrow = now.add(const Duration(days: 1));
if (_isSameDay(date, tomorrow)) return "Tomorrow";
if (_isSameDay(date, tomorrow)) return t.staff_shifts.my_shifts_tab.date.tomorrow;
return DateFormat('EEE, MMM d').format(date);
} catch (_) {
return dateStr;
@@ -338,7 +338,7 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
const SizedBox(height: UiConstants.space5),
if (widget.pendingAssignments.isNotEmpty) ...[
_buildSectionHeader(
"Awaiting Confirmation",
t.staff_shifts.my_shifts_tab.sections.awaiting,
UiColors.textWarning,
),
...widget.pendingAssignments.map(
@@ -356,7 +356,7 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
],
if (visibleCancelledShifts.isNotEmpty) ...[
_buildSectionHeader("Cancelled Shifts", UiColors.textSecondary),
_buildSectionHeader(t.staff_shifts.my_shifts_tab.sections.cancelled, UiColors.textSecondary),
...visibleCancelledShifts.map(
(shift) => Padding(
padding: const EdgeInsets.only(bottom: UiConstants.space4),
@@ -378,7 +378,7 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
// Confirmed Shifts
if (visibleMyShifts.isNotEmpty) ...[
_buildSectionHeader("Confirmed Shifts", UiColors.textSecondary),
_buildSectionHeader(t.staff_shifts.my_shifts_tab.sections.confirmed, UiColors.textSecondary),
...visibleMyShifts.map(
(shift) => Padding(
padding: const EdgeInsets.only(bottom: UiConstants.space3),
@@ -390,10 +390,10 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
if (visibleMyShifts.isEmpty &&
widget.pendingAssignments.isEmpty &&
widget.cancelledShifts.isEmpty)
const EmptyStateView(
EmptyStateView(
icon: UiIcons.calendar,
title: "No shifts this week",
subtitle: "Try finding new jobs in the Find tab",
title: t.staff_shifts.my_shifts_tab.empty.title,
subtitle: t.staff_shifts.my_shifts_tab.empty.subtitle,
),
const SizedBox(height: UiConstants.space32),
@@ -462,13 +462,13 @@ class _MyShiftsTabState extends State<MyShiftsTab> {
),
const SizedBox(width: 6),
Text(
"CANCELLED",
t.staff_shifts.my_shifts_tab.card.cancelled,
style: UiTypography.footnote2b.textError,
),
if (isLastMinute) ...[
const SizedBox(width: 4),
Text(
"• 4hr compensation",
t.staff_shifts.my_shifts_tab.card.compensation,
style: UiTypography.footnote2m.textSuccess,
),
],