loading state and error handling refactor

This commit is contained in:
2026-05-06 10:11:45 +02:00
parent 2c376afd91
commit 4b1d4379a0
48 changed files with 1377 additions and 354 deletions
+28 -5
View File
@@ -32,7 +32,7 @@ import 'storage/settings.dart';
import 'theming/dark_app_theme.dart';
import 'theming/light_app_theme.dart';
import 'view/login/login.dart';
import 'widget/placeholder_view.dart';
import 'widget/app_progress_indicator.dart';
Future<void> main() async {
log('MarianumMobile started');
@@ -68,9 +68,21 @@ Future<void> main() async {
);
if (kReleaseMode) {
ErrorWidget.builder = (error) => PlaceholderView(
icon: Icons.phonelink_erase_rounded,
text: error.toStringShort(),
ErrorWidget.builder = (error) => Material(
color: Colors.white,
child: Center(
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.phonelink_erase_rounded, size: 40),
const SizedBox(height: 12),
Text(error.toStringShort(), textAlign: TextAlign.center),
],
),
),
),
);
}
@@ -156,7 +168,18 @@ class _MainState extends State<Main> {
case AccountStatus.loggedOut:
return const Login();
case AccountStatus.undefined:
return const PlaceholderView(icon: Icons.timer, text: 'Daten werden geladen');
return const Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppProgressIndicator.large(),
SizedBox(height: 16),
Text('Konto wird geladen…'),
],
),
),
);
}
},
),