mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
29
lib/app.dart
29
lib/app.dart
@@ -3,10 +3,14 @@ import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:fl_lib/l10n/gen_l10n/lib_l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:server_box/core/extension/context/locale.dart';
|
||||
import 'package:server_box/data/res/build_data.dart';
|
||||
import 'package:server_box/data/res/rebuild.dart';
|
||||
import 'package:server_box/data/res/store.dart';
|
||||
import 'package:server_box/view/page/home/home.dart';
|
||||
import 'package:icons_plus/icons_plus.dart';
|
||||
|
||||
part 'intro.dart';
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
@@ -82,7 +86,30 @@ class MyApp extends StatelessWidget {
|
||||
|
||||
Widget _buildAppContent(BuildContext ctx) {
|
||||
//if (Pros.app.isWearOS) return const WearHome();
|
||||
return const HomePage();
|
||||
return const _AppContent(
|
||||
intro: _IntroPage(),
|
||||
child: HomePage(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// It's used for init settings related to [BuildContext]
|
||||
final class _AppContent extends StatelessWidget {
|
||||
final Widget child;
|
||||
final Widget intro;
|
||||
|
||||
const _AppContent({required this.child, required this.intro});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
context.setLibL10n();
|
||||
final appL10n = AppLocalizations.of(context);
|
||||
if (appL10n != null) l10n = appL10n;
|
||||
|
||||
final showIntro = Stores.setting.showIntro.fetch();
|
||||
if (showIntro) return intro;
|
||||
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user