reading test receipt text detected OK
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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',
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user