Files
ttstd_family_care/lib/main.dart
TongTongStudio 06cdc77172 feat(android): 支持沉浸式状态栏、地图定位与自定义签名
- 配置 edge-to-edge 沉浸式状态栏与刘海屏适配
- 新增百度地图权限、AK 配置及定位权限说明
- 接入 MethodChannel 实现返回键退后台热启动优化
- 配置自定义签名并更新构建逻辑
- 完善 token 刷新与鉴权失效统一处理
- 新增地图页与截图页路由
- 修复返回键拦截导致的 PopScope 失效问题
2026-08-19 03:43:12 +08:00

42 lines
1.8 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:material_ui/material_ui.dart' show WidgetsFlutterBinding;
import 'package:flutter/widgets.dart' show runApp;
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'
show BMFMapSDK, BMF_COORD_TYPE;
import 'package:flutter_baidu_mapapi_map/flutter_baidu_mapapi_map.dart'
show BMFAndroidVersion;
import 'app/app.dart';
import 'app/constants/app_constants.dart';
import 'app/router/app_router.dart';
import 'core/storage/token_storage.dart';
import 'core/utils/device_info_util.dart';
import 'core/utils/system_ui_util.dart';
/// 应用入口。
///
/// 职责:初始化存储、配置系统 UI、打印设备信息、构建路由与根组件。不包含任何业务或 UI 逻辑。
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// 初始化百度地图 SDK需申请 AK坐标类型使用 BD09LL设备 GPS 坐标在展示前转换)。
BMFMapSDK.setAgreePrivacy(true);
BMFMapSDK.setApiKeyAndCoordType(
AppConstants.kBaiduMapAk, BMF_COORD_TYPE.BD09LL);
// 初始化 Android 版本适配Android 10+ 使用 surfaceMapView比默认 textureMapView 更稳定),
// 避免百度 SDK 在模拟器 / 部分机型上因 textureView + EGL 渲染冲突触发原生崩溃SIGSEGV / EGL_BAD_MATCH
await BMFAndroidVersion.initAndroidVersion();
// 沉浸式状态栏 / edge-to-edge / 刘海屏适配(不影响启动主流程)。
await SystemUiUtil.configure();
// 初始化本地存储(含超时保护,避免阻塞启动导致卡在首屏)。
await TokenStorage.initialize()
.timeout(const Duration(seconds: 5), onTimeout: () {});
// 设备信息打印不阻塞启动主流程。
DeviceInfoUtil.printDeviceInfo();
final router = buildAppRouter();
runApp(buildApp(router));
}