From 3489ae4060ae25e28d9af5606e75a984a1fd20b7 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Sun, 1 Feb 2026 21:23:58 -0500 Subject: [PATCH] feat: Add checkCircle icon and update ViewOrderCard and ViewOrdersHeader for improved date handling and UI feedback --- .../design_system/lib/src/ui_icons.dart | 3 + .../presentation/widgets/view_order_card.dart | 12 +- .../widgets/view_orders_header.dart | 119 ++++++++++-------- .../features/client/view_orders/pubspec.yaml | 4 + 4 files changed, 81 insertions(+), 57 deletions(-) diff --git a/apps/mobile/packages/design_system/lib/src/ui_icons.dart b/apps/mobile/packages/design_system/lib/src/ui_icons.dart index e035bf63..6acff6a9 100644 --- a/apps/mobile/packages/design_system/lib/src/ui_icons.dart +++ b/apps/mobile/packages/design_system/lib/src/ui_icons.dart @@ -63,6 +63,9 @@ class UiIcons { /// Checkmark icon static const IconData check = _IconLib.check; + /// Checkmark circle icon + static const IconData checkCircle = _IconLib.checkCircle; + /// X/Cancel icon static const IconData close = _IconLib.x; diff --git a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_order_card.dart b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_order_card.dart index 7ded64a7..76416e5d 100644 --- a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_order_card.dart +++ b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_order_card.dart @@ -326,15 +326,23 @@ class _ViewOrderCardState extends State { children: [ Row( children: [ - if (order.workersNeeded != 0) + if (coveragePercent != 100) const Icon( UiIcons.error, size: 16, color: UiColors.textError, ), + if (coveragePercent == 100) + const Icon( + UiIcons.checkCircle, + size: 16, + color: UiColors.textSuccess, + ), const SizedBox(width: 8), Text( - '${order.workersNeeded} Workers Needed', + coveragePercent == 100 + ? 'All Workers Confirmed' + : '${order.workersNeeded} Workers Needed', style: UiTypography.body2m.textPrimary, ), ], diff --git a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_orders_header.dart b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_orders_header.dart index c53cf6f0..45e72f93 100644 --- a/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_orders_header.dart +++ b/apps/mobile/packages/features/client/view_orders/lib/src/presentation/widgets/view_orders_header.dart @@ -182,67 +182,76 @@ class ViewOrdersHeader extends StatelessWidget { (OrderItem s) => s.date == dateStr, ); - return GestureDetector( - onTap: () => BlocProvider.of( - context, - ).selectDate(date), - child: AnimatedContainer( - duration: const Duration(milliseconds: 200), - width: 48, - decoration: BoxDecoration( - color: isSelected ? UiColors.primary : UiColors.white, - borderRadius: BorderRadius.circular(16), - border: Border.all( - color: isSelected - ? UiColors.primary - : UiColors.separatorPrimary, - ), - boxShadow: isSelected - ? [ - BoxShadow( - color: UiColors.primary.withValues( - alpha: 0.25, + // Check if date is in the past + final DateTime now = DateTime.now(); + final DateTime today = DateTime(now.year, now.month, now.day); + final DateTime checkDate = DateTime(date.year, date.month, date.day); + final bool isPast = checkDate.isBefore(today); + + return Opacity( + opacity: isPast && !isSelected ? 0.5 : 1.0, + child: GestureDetector( + onTap: () => BlocProvider.of( + context, + ).selectDate(date), + child: AnimatedContainer( + duration: const Duration(milliseconds: 200), + width: 48, + decoration: BoxDecoration( + color: isSelected ? UiColors.primary : UiColors.white, + borderRadius: BorderRadius.circular(16), + border: Border.all( + color: isSelected + ? UiColors.primary + : UiColors.separatorPrimary, + ), + boxShadow: isSelected + ? [ + BoxShadow( + color: UiColors.primary.withValues( + alpha: 0.25, + ), + blurRadius: 12, + offset: const Offset(0, 4), ), - blurRadius: 12, - offset: const Offset(0, 4), - ), - ] - : null, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - DateFormat('dd').format(date), - style: UiTypography.title2b.copyWith( - fontSize: 18, - color: isSelected - ? UiColors.white - : UiColors.textPrimary, - ), - ), - Text( - DateFormat('E').format(date), - style: UiTypography.footnote2m.copyWith( - color: isSelected - ? UiColors.white.withValues(alpha: 0.8) - : UiColors.textSecondary, - ), - ), - if (hasShifts) ...[ - const SizedBox(height: UiConstants.space1), - Container( - width: 6, - height: 6, - decoration: BoxDecoration( + ] + : null, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + DateFormat('dd').format(date), + style: UiTypography.title2b.copyWith( + fontSize: 18, color: isSelected ? UiColors.white - : UiColors.primary, - shape: BoxShape.circle, + : UiColors.textPrimary, ), ), + Text( + DateFormat('E').format(date), + style: UiTypography.footnote2m.copyWith( + color: isSelected + ? UiColors.white.withValues(alpha: 0.8) + : UiColors.textSecondary, + ), + ), + if (hasShifts) ...[ + const SizedBox(height: UiConstants.space1), + Container( + width: 6, + height: 6, + decoration: BoxDecoration( + color: isSelected + ? UiColors.white + : UiColors.primary, + shape: BoxShape.circle, + ), + ), + ], ], - ], + ), ), ), ); diff --git a/apps/mobile/packages/features/client/view_orders/pubspec.yaml b/apps/mobile/packages/features/client/view_orders/pubspec.yaml index 5c419aa9..46182d70 100644 --- a/apps/mobile/packages/features/client/view_orders/pubspec.yaml +++ b/apps/mobile/packages/features/client/view_orders/pubspec.yaml @@ -25,10 +25,14 @@ dependencies: path: ../../../domain krow_core: path: ../../../core + krow_data_connect: + path: ../../../data_connect # UI lucide_icons: ^0.257.0 intl: ^0.20.1 url_launcher: ^6.3.1 + firebase_data_connect: ^0.2.2+2 + firebase_auth: ^6.1.4 dev_dependencies: flutter_test: