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

@@ -1,3 +1,4 @@
import 'package:core_localization/core_localization.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
@@ -47,7 +48,7 @@ class CoverageWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
"TODAY'S COVERAGE",
t.client_home.dashboard.todays_coverage,
style: UiTypography.footnote1b.copyWith(
color: UiColors.textPrimary,
letterSpacing: 0.5,
@@ -64,8 +65,8 @@ class CoverageWidget extends StatelessWidget {
color: backgroundColor,
borderRadius: UiConstants.radiusLg,
),
child: Text(
'$coveragePercent% Covered',
child: Text(
t.client_home.dashboard.percent_covered(percent: coveragePercent),
style: UiTypography.footnote2b.copyWith(color: textColor),
),
),
@@ -81,7 +82,7 @@ class CoverageWidget extends StatelessWidget {
child: _MetricCard(
icon: UiIcons.target,
iconColor: UiColors.primary,
label: 'Needed',
label: t.client_home.dashboard.metric_needed,
value: '$totalNeeded',
),
),
@@ -91,7 +92,7 @@ class CoverageWidget extends StatelessWidget {
child: _MetricCard(
icon: UiIcons.success,
iconColor: UiColors.iconSuccess,
label: 'Filled',
label: t.client_home.dashboard.metric_filled,
value: '$totalConfirmed',
valueColor: UiColors.textSuccess,
),
@@ -101,7 +102,7 @@ class CoverageWidget extends StatelessWidget {
child: _MetricCard(
icon: UiIcons.error,
iconColor: UiColors.iconError,
label: 'Open',
label: t.client_home.dashboard.metric_open,
value: '${totalNeeded - totalConfirmed}',
valueColor: UiColors.textError,
),

View File

@@ -65,6 +65,8 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
dc.ListTeamHubsByOwnerIdTeamHubs? _selectedHub;
bool _showSuccess = false;
Map<String, dynamic>? _submitData;
bool _isSubmitting = false;
String? _errorMessage;
@override
void initState() {
@@ -190,7 +192,25 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
}
Future<void> _handleSubmit() async {
await _submitNewOrder();
if (_isSubmitting) return;
setState(() {
_isSubmitting = true;
_errorMessage = null;
});
try {
await _submitNewOrder();
} catch (e) {
if (!mounted) return;
setState(() {
_isSubmitting = false;
_errorMessage = 'Failed to create order. Please try again.';
});
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(_errorMessage!)),
);
}
}
Future<void> _submitNewOrder() async {
@@ -296,6 +316,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
'date': _dateController.text,
};
_showSuccess = true;
_isSubmitting = false;
});
}
@@ -770,7 +791,7 @@ class _ShiftOrderFormSheetState extends State<ShiftOrderFormSheet> {
UiButton.primary(
text: widget.initialData != null ? 'Update Order' : 'Post Order',
onPressed: widget.isLoading ? null : _handleSubmit,
onPressed: (widget.isLoading || _isSubmitting) ? null : _handleSubmit,
),
SizedBox(height: MediaQuery.of(context).padding.bottom + UiConstants.space5),
],

View File

@@ -78,7 +78,7 @@ class SpendingWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'This Week',
t.client_home.dashboard.spending.this_week,
style: UiTypography.footnote2r.white.copyWith(
color: UiColors.white.withValues(alpha: 0.7),
fontSize: 9,
@@ -93,7 +93,7 @@ class SpendingWidget extends StatelessWidget {
),
),
Text(
'$weeklyShifts shifts',
t.client_home.dashboard.spending.shifts_count(count: weeklyShifts),
style: UiTypography.footnote2r.white.copyWith(
color: UiColors.white.withValues(alpha: 0.6),
fontSize: 9,
@@ -107,7 +107,7 @@ class SpendingWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
'Next 7 Days',
t.client_home.dashboard.spending.next_7_days,
style: UiTypography.footnote2r.white.copyWith(
color: UiColors.white.withValues(alpha: 0.7),
fontSize: 9,
@@ -122,7 +122,7 @@ class SpendingWidget extends StatelessWidget {
),
),
Text(
'$next7DaysScheduled scheduled',
t.client_home.dashboard.spending.scheduled_count(count: next7DaysScheduled),
style: UiTypography.footnote2r.white.copyWith(
color: UiColors.white.withValues(alpha: 0.6),
fontSize: 9,