feat: Add orderId and normalized orderType to the Shift model to enable UI grouping and type-badging in shift displays.

This commit is contained in:
Achintha Isuru
2026-02-22 11:46:38 -05:00
parent 6e43888187
commit b519c49406
4 changed files with 210 additions and 107 deletions

View File

@@ -1,12 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:design_system/design_system.dart';
import 'package:core_localization/core_localization.dart';
import 'package:krow_core/core.dart';
/// Card widget for displaying pending payment information, using design system tokens.
class PendingPaymentCard extends StatelessWidget {
/// Creates a [PendingPaymentCard].
@@ -21,7 +19,10 @@ class PendingPaymentCard extends StatelessWidget {
padding: const EdgeInsets.all(UiConstants.space4),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [UiColors.primary.withOpacity(0.08), UiColors.primary.withOpacity(0.04)],
colors: [
UiColors.primary.withOpacity(0.08),
UiColors.primary.withOpacity(0.04),
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
@@ -59,7 +60,9 @@ class PendingPaymentCard extends StatelessWidget {
),
Text(
pendingI18n.subtitle,
style: UiTypography.body3r.copyWith(color: UiColors.mutedForeground),
style: UiTypography.body3r.copyWith(
color: UiColors.mutedForeground,
),
overflow: TextOverflow.ellipsis,
),
],
@@ -70,10 +73,7 @@ class PendingPaymentCard extends StatelessWidget {
),
Row(
children: [
Text(
'\$285.00',
style: UiTypography.headline4m,
),
Text('\$285.00', style: UiTypography.headline4m),
SizedBox(width: UiConstants.space2),
Icon(
UiIcons.chevronRight,

View File

@@ -185,12 +185,15 @@ class _MyShiftCardState extends State<MyShiftCard> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Status Badge
if (statusText.isNotEmpty)
Padding(
padding: const EdgeInsets.only(bottom: UiConstants.space2),
child: Row(
children: [
// Badge row: shows the status label and the shift-type chip.
// The type chip (One Day / Multi-Day / Long Term) is always
// rendered when orderType is present — even for "open" find-shifts
// cards that may have no meaningful status text.
Padding(
padding: const EdgeInsets.only(bottom: UiConstants.space2),
child: Row(
children: [
if (statusText.isNotEmpty) ...[
if (statusIcon != null)
Padding(
padding: const EdgeInsets.only(
@@ -221,30 +224,31 @@ class _MyShiftCardState extends State<MyShiftCard> {
letterSpacing: 0.5,
),
),
// Shift Type Badge (Order type)
if ((widget.shift.orderType ?? '').isNotEmpty) ...[
const SizedBox(width: UiConstants.space2),
Container(
padding: const EdgeInsets.symmetric(
horizontal: UiConstants.space2,
vertical: 2,
),
decoration: BoxDecoration(
color: UiColors.background,
borderRadius: UiConstants.radiusSm,
border: Border.all(color: UiColors.border),
),
child: Text(
_getShiftType(),
style: UiTypography.footnote2m.copyWith(
color: UiColors.textSecondary,
),
),
),
],
const SizedBox(width: UiConstants.space2),
],
),
// Type badge — driven by RECURRING / PERMANENT / one-day
// order data and always visible so users can filter
// Find Shifts cards at a glance.
Container(
padding: const EdgeInsets.symmetric(
horizontal: UiConstants.space2,
vertical: 2,
),
decoration: BoxDecoration(
color: UiColors.background,
borderRadius: UiConstants.radiusSm,
border: Border.all(color: UiColors.border),
),
child: Text(
_getShiftType(),
style: UiTypography.footnote2m.copyWith(
color: UiColors.textSecondary,
),
),
),
],
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@@ -85,11 +85,13 @@ class _FindShiftsTabState extends State<FindShiftsTab> {
final Shift first = group.first;
final List<ShiftSchedule> schedules = group
.map((s) => ShiftSchedule(
date: s.date,
startTime: s.startTime,
endTime: s.endTime,
))
.map(
(s) => ShiftSchedule(
date: s.date,
startTime: s.startTime,
endTime: s.endTime,
),
)
.toList();
result.add(