main() awaited all of configureDependencies() (open the encrypted DB, derive the social key, seed/scan the species catalog) before the first runApp, so nothing painted until init finished — startup jank visible as skipped frames. Now main() runs runApp immediately with a Bootstrap widget that shows a native-splash-matching green splash while the heavy work runs, then swaps in TaneApp. On failure it shows a localized error with a retry (configureDependencies is idempotent, so retry is safe). Adds a bootstrap i18n group (en/es/pt/ast) and a widget test for the splash/error frame.
15 lines
650 B
Dart
15 lines
650 B
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
import 'bootstrap.dart';
|
|
import 'i18n/strings.g.dart';
|
|
|
|
void main() {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
// Start from the device language, then let an explicit in-app choice win —
|
|
// it's the only reliable way to reach languages the OS picker doesn't offer
|
|
// (e.g. Asturian). The saved choice is restored inside [Bootstrap], after DI.
|
|
LocaleSettings.useDeviceLocaleSync();
|
|
// Paint immediately: [Bootstrap] shows a splash and runs the heavy init off
|
|
// the first frame, so the app window appears at once instead of after DI.
|
|
runApp(TranslationProvider(child: const Bootstrap()));
|
|
}
|