loading state and error handling refactor
This commit is contained in:
+28
-5
@@ -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…'),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user