Refactor shift history and my shifts tabs to use a unified ShiftCard widget

- Introduced ShiftCard widget to standardize the display of shift information across different states (assigned, completed, cancelled, pending).
- Removed redundant card implementations (_CompletedShiftCard, MyShiftCard, ShiftAssignmentCard) and replaced them with ShiftCard.
- Updated localization for empty states and shift titles in HistoryShiftsTab and MyShiftsTab.
- Enhanced MyShiftsTab to track submitted shifts locally and show appropriate actions based on shift status.
- Added meta package dependency for improved type annotations.
This commit is contained in:
Achintha Isuru
2026-03-17 13:08:32 -04:00
parent 020c785b6f
commit a0d5a18e6f
6 changed files with 945 additions and 306 deletions

View File

@@ -1,6 +1,5 @@
import 'package:equatable/equatable.dart';
import 'package:krow_domain/src/entities/enums/payment_status.dart';
import 'package:krow_domain/krow_domain.dart';
/// A shift the staff member has completed.
///
@@ -16,6 +15,7 @@ class CompletedShift extends Equatable {
required this.date,
required this.minutesWorked,
required this.paymentStatus,
required this.status,
});
/// Deserialises from the V2 API JSON response.
@@ -28,6 +28,7 @@ class CompletedShift extends Equatable {
date: DateTime.parse(json['date'] as String),
minutesWorked: json['minutesWorked'] as int? ?? 0,
paymentStatus: PaymentStatus.fromJson(json['paymentStatus'] as String?),
status: AssignmentStatus.completed,
);
}
@@ -52,6 +53,9 @@ class CompletedShift extends Equatable {
/// Payment processing status.
final PaymentStatus paymentStatus;
/// Assignment status (should always be `completed` for this class).
final AssignmentStatus status;
/// Serialises to JSON.
Map<String, dynamic> toJson() {
return <String, dynamic>{