fix(mobile): use UserPrefs dateFormatKey and timeFormatKey in UI

Screens referenced dateFormat and timeFormat, which do not exist on
UserPrefs. Align with the model and date_format_utils key-based API so
flutter analyze and tests compile.
This commit is contained in:
Dries Peeters
2026-03-28 19:48:54 +01:00
parent 29f085a148
commit c09dbbf108
4 changed files with 7 additions and 7 deletions
@@ -273,7 +273,7 @@ class _DashboardTabState extends ConsumerState<DashboardTab> {
: formatDateRange(
entry.startTime,
entry.endTime,
ref.watch(userPrefsProvider).valueOrNull?.dateFormat,
ref.watch(userPrefsProvider).valueOrNull?.dateFormatKey,
);
return Card(
margin: const EdgeInsets.only(bottom: AppSpacing.sm),
@@ -138,7 +138,7 @@ class _TimeEntriesScreenState extends ConsumerState<TimeEntriesScreen> {
void _showFilterDialog() {
final currentFilter = ref.read(timeEntriesProvider).filter;
final prefs = ref.read(userPrefsProvider).valueOrNull;
final dateFormatKey = prefs?.dateFormat;
final dateFormatKey = prefs?.dateFormatKey;
DateTime? startDate;
DateTime? endDate;
@@ -341,8 +341,8 @@ class _TimeEntryFormScreenState extends ConsumerState<TimeEntryFormScreen> {
_startTime.hour,
_startTime.minute,
),
ref.read(userPrefsProvider).valueOrNull?.dateFormat,
ref.read(userPrefsProvider).valueOrNull?.timeFormat,
ref.read(userPrefsProvider).valueOrNull?.dateFormatKey,
ref.read(userPrefsProvider).valueOrNull?.timeFormatKey,
),
),
trailing: const Icon(Icons.calendar_today),
@@ -362,8 +362,8 @@ class _TimeEntryFormScreenState extends ConsumerState<TimeEntryFormScreen> {
_endTime!.hour,
_endTime!.minute,
),
ref.read(userPrefsProvider).valueOrNull?.dateFormat,
ref.read(userPrefsProvider).valueOrNull?.timeFormat,
ref.read(userPrefsProvider).valueOrNull?.dateFormatKey,
ref.read(userPrefsProvider).valueOrNull?.timeFormatKey,
)
: 'Not set',
),
@@ -111,7 +111,7 @@ class TimeEntryCard extends ConsumerWidget {
formatDateRange(
entry.startTime,
entry.endTime,
ref.watch(userPrefsProvider).valueOrNull?.dateFormat,
ref.watch(userPrefsProvider).valueOrNull?.dateFormatKey,
),
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,