app-starlock/lib/main.dart

57 lines
1.7 KiB
Dart
Raw Normal View History

import 'dart:async';
2024-05-18 14:57:02 +08:00
2024-05-18 18:25:39 +08:00
import 'package:flutter/foundation.dart';
2023-07-10 17:50:31 +08:00
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
2024-05-18 18:25:39 +08:00
import 'package:flutter_bugly_plugin/flutter_bugly_plugin.dart';
2024-05-18 14:57:02 +08:00
import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
2024-05-18 18:25:39 +08:00
import 'package:star_lock/tools/bugly/bugly_tool.dart';
2023-07-10 17:50:31 +08:00
import 'package:star_lock/tools/device_info_service.dart';
import 'package:star_lock/tools/platform_info_services.dart';
2024-05-18 14:57:02 +08:00
import 'package:star_lock/translations/trans_lib.dart';
import 'app.dart';
import 'app_settings/app_settings.dart';
import 'tools/store_service.dart';
2023-07-10 17:50:31 +08:00
// 该文件不可作为编译入口,请查看 flavorizr.yaml 中的说明
FutureOr<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
2023-08-26 11:40:40 +08:00
await _setCommonServices();
2023-07-10 17:50:31 +08:00
// 设置国际化信息
await _initTranslation();
2024-05-18 18:25:39 +08:00
// bugly错误日志监控
await BuglyTool.init();
runApp(const MyApp());
if (AppPlatform.isAndroid) {
2024-05-18 14:57:02 +08:00
const SystemUiOverlayStyle systemUiOverlayStyle =
SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
}
2023-07-10 17:50:31 +08:00
}
// 设置国际化信息
Future _initTranslation() async => TranslationLoader.loadTranslation(
2024-05-18 14:57:02 +08:00
zhSource: 'images/lan/lan_zh.json',
enSource: 'images/lan/lan_en.json',
keySource: 'images/lan/lan_keys.json',
);
2023-07-10 17:50:31 +08:00
// 设置包名服务设备信息
Future _setCommonServices() async {
await Get.putAsync(() => StoreService().init());
await Get.putAsync(() => PlatformInfoService().init());
2024-03-28 09:51:30 +08:00
if (F.isLite) {
//上架审核注释 获取设备信息
// await Get.putAsync(() => DeviceInfoService().init());
} else {
await Get.putAsync(() => DeviceInfoService().init());
}
}