Files
ingtrakapp/lib/utils/constants.dart
T
2026-09-10 16:25:24 +02:00

78 lines
2.8 KiB
Dart

/// Shared string keys, timings, and layout breakpoints used across the app.
library;
import 'app_config.dart';
/// Human-readable name shown in the splash screen, app bars, and About tile.
const String kAppName = 'IngTrak';
/// Package / Android application id.
const String kPackageName = 'com.ingtrak.app';
/// How long the splash screen stays visible before navigating to the shell.
const Duration kSplashDuration = Duration(seconds: 2);
/// FastAPI bank backend. From `.env` / `--dart-define=API_BASE_URL=…`.
String get kApiBaseUrl => AppConfig.apiBaseUrl;
/// PocketBase server. From `.env` / `--dart-define=POCKETBASE_URL=…`.
String get kPocketBaseUrl => AppConfig.pocketBaseUrl;
/// PocketBase auth collection name (default `usersapp`).
String get kPocketBaseUsersCollection => AppConfig.pocketBaseUsersCollection;
/// Enable Banking redirect derived from [kApiBaseUrl].
/// Must match backend `REDIRECT_URI` and the Control Panel whitelist.
/// The app opens auth in a WebView and intercepts this callback path for `code`.
String get kEnableBankingRedirectUri {
final base = kApiBaseUrl.endsWith('/')
? kApiBaseUrl.substring(0, kApiBaseUrl.length - 1)
: kApiBaseUrl;
return '$base/api/connect/callback';
}
/// Optional app-scheme bounce used after the http callback (not registered
/// with Enable Banking).
const String kBankRedirectScheme = 'ingtrak';
const String kBankRedirectHost = 'connected';
const String kBankRedirectUri = '$kBankRedirectScheme://$kBankRedirectHost';
/// SharedPreferences keys.
abstract final class StorageKeys {
static const themeMode = 'theme_mode';
static const useRemoteData = 'use_remote_data';
static const txMeta = 'tx_meta_v2';
static const txMetaLegacy = 'tx_meta_v1';
static const bankCache = 'bank_cache_v1';
static const importedTransactions = 'imported_txs_v1';
/// Serialized PocketBase auth token + user record (separate from tx data).
static const pocketBaseAuth = 'pb_auth_v1';
/// How many years ahead Look ahead can navigate (default 5).
static const lookAheadMaxYears = 'look_ahead_max_years_v1';
/// Named Overview chart favourites (JSON list).
static const overviewFavourites = 'overview_favourites_v1';
/// Home screen filter widgets (JSON list).
static const homeFilterWidgets = 'home_filter_widgets_v1';
}
/// 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;