mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-18 22:33:42 +00:00
fix(ui): preserve mobile home route and confirm Android exit (#1507)
This commit is contained in:
10 files changed
+484
-96
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import '../application/app_runtime_controller.dart';
|
||||
import '../../l10n/l10n.dart';
|
||||
|
||||
/// Gates page content without unmounting the Navigator during startup.
|
||||
class RuntimePage extends ConsumerWidget {
|
||||
const RuntimePage({super.key, required this.builder});
|
||||
|
||||
final WidgetBuilder builder;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return ref
|
||||
.watch(appRuntimeControllerProvider)
|
||||
.when(
|
||||
loading: () => const Scaffold(child: Center(child: CircularProgressIndicator())),
|
||||
error: (error, _) => Scaffold(
|
||||
child: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 420),
|
||||
child: Text(context.l10n.runtimeInitializationFailed(error.toString()), textAlign: TextAlign.center),
|
||||
),
|
||||
),
|
||||
),
|
||||
data: (_) => builder(context),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user