mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
@@ -4,7 +4,6 @@ import 'package:PiliPlus/build_config.dart';
|
||||
import 'package:PiliPlus/pages/video/detail/view_v.dart';
|
||||
import 'package:PiliPlus/utils/cache_manage.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:flex_seed_scheme/flex_seed_scheme.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
||||
@@ -91,17 +90,11 @@ Commit Hash: ${BuildConfig.commitHash}''';
|
||||
},
|
||||
);
|
||||
|
||||
bool? isXiaomi;
|
||||
if (Platform.isAndroid) {
|
||||
final androidInfo = await DeviceInfoPlugin().androidInfo;
|
||||
isXiaomi = androidInfo.manufacturer.toLowerCase() == 'xiaomi';
|
||||
}
|
||||
|
||||
Catcher2(
|
||||
debugConfig: debugConfig,
|
||||
releaseConfig: releaseConfig,
|
||||
runAppFunction: () {
|
||||
runApp(MyApp(isXiaomi: isXiaomi));
|
||||
runApp(const MyApp());
|
||||
},
|
||||
);
|
||||
|
||||
@@ -118,9 +111,7 @@ Commit Hash: ${BuildConfig.commitHash}''';
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key, this.isXiaomi});
|
||||
|
||||
final bool? isXiaomi;
|
||||
const MyApp({super.key});
|
||||
|
||||
Box get setting => GStorage.setting;
|
||||
|
||||
@@ -213,31 +204,19 @@ class MyApp extends StatelessWidget {
|
||||
fallbackLocale: const Locale("zh", "CN"),
|
||||
getPages: Routes.getPages,
|
||||
home: const MainApp(),
|
||||
builder: isXiaomi == true
|
||||
? (BuildContext context, Widget? child) {
|
||||
return FlutterSmartDialog(
|
||||
toastBuilder: (String msg) => CustomToast(msg: msg),
|
||||
loadingBuilder: (msg) => LoadingWidget(msg: msg),
|
||||
child: MediaQuery(
|
||||
data: MediaQuery.of(context)
|
||||
.copyWith(textScaler: TextScaler.linear(textScale)),
|
||||
child: child!,
|
||||
),
|
||||
);
|
||||
}
|
||||
: FlutterSmartDialog.init(
|
||||
toastBuilder: (String msg) => CustomToast(msg: msg),
|
||||
loadingBuilder: (msg) => LoadingWidget(msg: msg),
|
||||
builder: (context, child) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context)
|
||||
.copyWith(textScaler: TextScaler.linear(textScale)),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
),
|
||||
builder: FlutterSmartDialog.init(
|
||||
toastBuilder: (String msg) => CustomToast(msg: msg),
|
||||
loadingBuilder: (msg) => LoadingWidget(msg: msg),
|
||||
builder: (context, child) {
|
||||
return MediaQuery(
|
||||
data: MediaQuery.of(context)
|
||||
.copyWith(textScaler: TextScaler.linear(textScale)),
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
),
|
||||
navigatorObservers: [
|
||||
if (isXiaomi != true) FlutterSmartDialog.observer,
|
||||
FlutterSmartDialog.observer,
|
||||
VideoDetailPageV.routeObserver,
|
||||
MainApp.routeObserver,
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user