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