reading test receipt text detected OK

This commit is contained in:
davmar
2026-08-28 19:14:38 +02:00
parent 0311b8955a
commit 2d8fc46a30
31 changed files with 356 additions and 2289 deletions
+4 -31
View File
@@ -1,34 +1,7 @@
/// Shared string keys, timings, and layout breakpoints used across the app.
/// Shared strings used across the app.
library;
/// Human-readable name shown in the splash screen, app bars, and About tile.
const String kAppName = 'MyApp';
const String kAppName = 'Receipity';
/// Package / Android application id.
const String kPackageName = 'com.example.myapp';
/// How long the splash screen stays visible before navigating to the shell.
const Duration kSplashDuration = Duration(seconds: 2);
/// SharedPreferences keys.
abstract final class StorageKeys {
static const themeMode = 'theme_mode';
static const useRemoteData = 'use_remote_data';
}
/// Named routes registered on [MaterialApp].
abstract final class AppRoutes {
static const splash = '/';
static const shell = '/shell';
static const itemDetail = '/item';
static const addItem = '/add-item';
}
/// Width thresholds used to adapt padding and card density.
abstract final class Breakpoints {
static const compact = 600.0;
static const medium = 840.0;
}
/// Maximum content width on tablets / large phones so lists stay readable.
const double kMaxContentWidth = 720.0;
/// Bundled Jumbo receipt used to test OCR without the camera.
const String kSampleReceiptAsset = 'assets/receipt.jpeg';
-59
View File
@@ -1,59 +0,0 @@
/// Small pure helpers for layout, formatting, and user-facing strings.
library;
import 'package:flutter/material.dart';
import 'constants.dart';
/// Horizontal padding that grows a little on wider screens.
double pagePadding(double width) {
if (width >= Breakpoints.medium) return 32;
if (width >= Breakpoints.compact) return 24;
return 16;
}
/// Formats [date] as `MMM d, y` without pulling in `intl`.
String formatDate(DateTime date) {
const months = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
];
return '${months[date.month - 1]} ${date.day}, ${date.year}';
}
/// Converts a stored theme key into a [ThemeMode].
ThemeMode themeModeFromName(String name) {
return switch (name) {
'light' => ThemeMode.light,
'dark' => ThemeMode.dark,
_ => ThemeMode.system,
};
}
/// Inverse of [themeModeFromName] for persistence.
String nameFromThemeMode(ThemeMode mode) {
return switch (mode) {
ThemeMode.light => 'light',
ThemeMode.dark => 'dark',
ThemeMode.system => 'system',
};
}
/// Title-cases a [ThemeMode] for settings labels.
String labelForThemeMode(ThemeMode mode) {
return switch (mode) {
ThemeMode.light => 'Light',
ThemeMode.dark => 'Dark',
ThemeMode.system => 'System',
};
}