feat: Add checkCircle icon and update ViewOrderCard and ViewOrdersHeader for improved date handling and UI feedback
This commit is contained in:
@@ -63,6 +63,9 @@ class UiIcons {
|
|||||||
/// Checkmark icon
|
/// Checkmark icon
|
||||||
static const IconData check = _IconLib.check;
|
static const IconData check = _IconLib.check;
|
||||||
|
|
||||||
|
/// Checkmark circle icon
|
||||||
|
static const IconData checkCircle = _IconLib.checkCircle;
|
||||||
|
|
||||||
/// X/Cancel icon
|
/// X/Cancel icon
|
||||||
static const IconData close = _IconLib.x;
|
static const IconData close = _IconLib.x;
|
||||||
|
|
||||||
|
|||||||
@@ -326,15 +326,23 @@ class _ViewOrderCardState extends State<ViewOrderCard> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
if (order.workersNeeded != 0)
|
if (coveragePercent != 100)
|
||||||
const Icon(
|
const Icon(
|
||||||
UiIcons.error,
|
UiIcons.error,
|
||||||
size: 16,
|
size: 16,
|
||||||
color: UiColors.textError,
|
color: UiColors.textError,
|
||||||
),
|
),
|
||||||
|
if (coveragePercent == 100)
|
||||||
|
const Icon(
|
||||||
|
UiIcons.checkCircle,
|
||||||
|
size: 16,
|
||||||
|
color: UiColors.textSuccess,
|
||||||
|
),
|
||||||
const SizedBox(width: 8),
|
const SizedBox(width: 8),
|
||||||
Text(
|
Text(
|
||||||
'${order.workersNeeded} Workers Needed',
|
coveragePercent == 100
|
||||||
|
? 'All Workers Confirmed'
|
||||||
|
: '${order.workersNeeded} Workers Needed',
|
||||||
style: UiTypography.body2m.textPrimary,
|
style: UiTypography.body2m.textPrimary,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -182,67 +182,76 @@ class ViewOrdersHeader extends StatelessWidget {
|
|||||||
(OrderItem s) => s.date == dateStr,
|
(OrderItem s) => s.date == dateStr,
|
||||||
);
|
);
|
||||||
|
|
||||||
return GestureDetector(
|
// Check if date is in the past
|
||||||
onTap: () => BlocProvider.of<ViewOrdersCubit>(
|
final DateTime now = DateTime.now();
|
||||||
context,
|
final DateTime today = DateTime(now.year, now.month, now.day);
|
||||||
).selectDate(date),
|
final DateTime checkDate = DateTime(date.year, date.month, date.day);
|
||||||
child: AnimatedContainer(
|
final bool isPast = checkDate.isBefore(today);
|
||||||
duration: const Duration(milliseconds: 200),
|
|
||||||
width: 48,
|
return Opacity(
|
||||||
decoration: BoxDecoration(
|
opacity: isPast && !isSelected ? 0.5 : 1.0,
|
||||||
color: isSelected ? UiColors.primary : UiColors.white,
|
child: GestureDetector(
|
||||||
borderRadius: BorderRadius.circular(16),
|
onTap: () => BlocProvider.of<ViewOrdersCubit>(
|
||||||
border: Border.all(
|
context,
|
||||||
color: isSelected
|
).selectDate(date),
|
||||||
? UiColors.primary
|
child: AnimatedContainer(
|
||||||
: UiColors.separatorPrimary,
|
duration: const Duration(milliseconds: 200),
|
||||||
),
|
width: 48,
|
||||||
boxShadow: isSelected
|
decoration: BoxDecoration(
|
||||||
? <BoxShadow>[
|
color: isSelected ? UiColors.primary : UiColors.white,
|
||||||
BoxShadow(
|
borderRadius: BorderRadius.circular(16),
|
||||||
color: UiColors.primary.withValues(
|
border: Border.all(
|
||||||
alpha: 0.25,
|
color: isSelected
|
||||||
|
? UiColors.primary
|
||||||
|
: UiColors.separatorPrimary,
|
||||||
|
),
|
||||||
|
boxShadow: isSelected
|
||||||
|
? <BoxShadow>[
|
||||||
|
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(
|
||||||
: null,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
),
|
children: <Widget>[
|
||||||
child: Column(
|
Text(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
DateFormat('dd').format(date),
|
||||||
children: <Widget>[
|
style: UiTypography.title2b.copyWith(
|
||||||
Text(
|
fontSize: 18,
|
||||||
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) ...<Widget>[
|
|
||||||
const SizedBox(height: UiConstants.space1),
|
|
||||||
Container(
|
|
||||||
width: 6,
|
|
||||||
height: 6,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? UiColors.white
|
? UiColors.white
|
||||||
: UiColors.primary,
|
: UiColors.textPrimary,
|
||||||
shape: BoxShape.circle,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
|
DateFormat('E').format(date),
|
||||||
|
style: UiTypography.footnote2m.copyWith(
|
||||||
|
color: isSelected
|
||||||
|
? UiColors.white.withValues(alpha: 0.8)
|
||||||
|
: UiColors.textSecondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (hasShifts) ...<Widget>[
|
||||||
|
const SizedBox(height: UiConstants.space1),
|
||||||
|
Container(
|
||||||
|
width: 6,
|
||||||
|
height: 6,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isSelected
|
||||||
|
? UiColors.white
|
||||||
|
: UiColors.primary,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -25,10 +25,14 @@ dependencies:
|
|||||||
path: ../../../domain
|
path: ../../../domain
|
||||||
krow_core:
|
krow_core:
|
||||||
path: ../../../core
|
path: ../../../core
|
||||||
|
krow_data_connect:
|
||||||
|
path: ../../../data_connect
|
||||||
# UI
|
# UI
|
||||||
lucide_icons: ^0.257.0
|
lucide_icons: ^0.257.0
|
||||||
intl: ^0.20.1
|
intl: ^0.20.1
|
||||||
url_launcher: ^6.3.1
|
url_launcher: ^6.3.1
|
||||||
|
firebase_data_connect: ^0.2.2+2
|
||||||
|
firebase_auth: ^6.1.4
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user