52 lines
1.6 KiB
Dart
52 lines
1.6 KiB
Dart
import 'dart:async';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:star_lock/debug/debug_console.dart';
|
|
import 'package:star_lock/flavors.dart';
|
|
import 'package:star_lock/translations/trans_lib.dart';
|
|
import 'app.dart';
|
|
import 'package:star_lock/tools/device_info_service.dart';
|
|
import 'package:star_lock/tools/platform_info_services.dart';
|
|
import 'app_settings/app_settings.dart';
|
|
import 'tools/store_service.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
// 该文件不可作为编译入口,请查看 flavorizr.yaml 中的说明
|
|
FutureOr<void> main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
await _setCommonServices();
|
|
|
|
// 设置国际化信息
|
|
await _initTranslation();
|
|
|
|
DebugConsole.listen(() {
|
|
runApp(const MyApp());
|
|
});
|
|
|
|
if (AppPlatform.isAndroid) {
|
|
SystemUiOverlayStyle systemUiOverlayStyle =
|
|
const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
|
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
|
|
}
|
|
}
|
|
|
|
// 设置国际化信息
|
|
Future _initTranslation() async => TranslationLoader.loadTranslation(
|
|
zhSource: "images/lan/lan_zh.json",
|
|
enSource: "images/lan/lan_en.json",
|
|
keySource: "images/lan/lan_keys.json",
|
|
);
|
|
|
|
// 设置包名服务设备信息
|
|
Future _setCommonServices() async {
|
|
await Get.putAsync(() => StoreService().init());
|
|
await Get.putAsync(() => PlatformInfoService().init());
|
|
if (F.isLite) {
|
|
//上架审核注释 获取设备信息
|
|
// await Get.putAsync(() => DeviceInfoService().init());
|
|
} else {
|
|
await Get.putAsync(() => DeviceInfoService().init());
|
|
}
|
|
}
|