You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.3 KiB
Dart
56 lines
1.3 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_displaymode/flutter_displaymode.dart';
|
|
import 'package:isekai_wiki/global.dart';
|
|
import 'package:package_info_plus/package_info_plus.dart';
|
|
|
|
import 'app.dart';
|
|
|
|
Future<void> init() async {
|
|
// 仅允许竖屏
|
|
/*SystemChrome.setPreferredOrientations(
|
|
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]);*/
|
|
SystemChrome.setSystemUIOverlayStyle(
|
|
const SystemUiOverlayStyle(statusBarColor: Colors.transparent));
|
|
|
|
if (kIsWeb) {
|
|
// 设置web origin
|
|
Global.webOrigin = Uri.base.origin;
|
|
}
|
|
}
|
|
|
|
Future<void> postInit() async {
|
|
if (!kIsWeb) {
|
|
// 启用高刷
|
|
try {
|
|
if (kDebugMode) {
|
|
var modes = await FlutterDisplayMode.supported;
|
|
print("Refresh rate list:");
|
|
// ignore: avoid_print
|
|
modes.forEach(print);
|
|
print("Preferred refresh rate:");
|
|
print(await FlutterDisplayMode.preferred);
|
|
}
|
|
await FlutterDisplayMode.setHighRefreshRate();
|
|
} catch (err) {
|
|
if (kDebugMode) {
|
|
print("Cannot set to high refresh rate: ");
|
|
print(err);
|
|
}
|
|
}
|
|
}
|
|
|
|
Global.packageInfo = await PackageInfo.fromPlatform();
|
|
}
|
|
|
|
void main() {
|
|
init();
|
|
|
|
runApp(const IsekaiWikiApp());
|
|
|
|
postInit();
|
|
}
|