1. 添加编辑器3D场景服务接口及实现 2. 实现平台IO工具类与数据库连接 3. 新增SVG图标资源 4. 优化编辑器操作Mixin架构 5. 修复Web端兼容性问题 6. 更新依赖配置与构建脚本 7. 改进主题自适应服务 8. 添加对齐辅助线组件 9. 完善迷你文字编辑栏 10. 优化页面过渡动画
68 lines
2.0 KiB
Dart
68 lines
2.0 KiB
Dart
// ============================================================
|
|
// 闲言APP — 应用入口
|
|
// 创建时间: 2026-04-20
|
|
// 更新时间: 2026-04-23
|
|
// 作用: main 函数,初始化存储 + 液态玻璃 + 异常捕获 + 启动 App
|
|
// 上次更新: 集成 catcher_2 异常捕获 (debug模式显示弹窗)
|
|
// ============================================================
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:catcher_2/catcher_2.dart';
|
|
import 'package:liquid_glass_widgets/liquid_glass_widgets.dart';
|
|
|
|
import 'app/app.dart';
|
|
import 'core/storage/kv_storage.dart';
|
|
import 'core/utils/logger.dart';
|
|
import 'core/registry/page_registry.dart';
|
|
import 'core/router/app_router.dart';
|
|
|
|
bool kvStorageReady = false;
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
Catcher2(
|
|
runAppFunction: () {
|
|
runApp(LiquidGlassWidgets.wrap(const ProviderScope(child: XianyanApp())));
|
|
},
|
|
debugConfig: Catcher2Options(
|
|
PageReportMode(),
|
|
[ConsoleHandler()],
|
|
localizationOptions: [LocalizationOptions.buildDefaultChineseOptions()],
|
|
),
|
|
releaseConfig: Catcher2Options(SilentReportMode(), [ConsoleHandler()]),
|
|
profileConfig: Catcher2Options(SilentReportMode(), [ConsoleHandler()]),
|
|
);
|
|
|
|
try {
|
|
await KvStorage.init();
|
|
kvStorageReady = true;
|
|
Log.i('KV 存储初始化完成');
|
|
} catch (e) {
|
|
Log.e('KV 存储初始化失败', e);
|
|
}
|
|
|
|
await LiquidGlassWidgets.initialize();
|
|
Log.i('LiquidGlassWidgets 初始化完成');
|
|
|
|
_validatePageRegistry();
|
|
}
|
|
|
|
/// 页面注册表强制验证
|
|
void _validatePageRegistry() {
|
|
final errors = PageRegistry.validateAll();
|
|
if (errors.isNotEmpty) {
|
|
for (final e in errors) {
|
|
Log.e('页面注册表验证失败: $e');
|
|
}
|
|
} else {
|
|
Log.i('页面注册表验证通过,共 ${PageRegistry.pageCount} 个页面已注册');
|
|
}
|
|
|
|
const route = AppRoutes.home;
|
|
if (!PageRegistry.isRouteRegistered(route)) {
|
|
Log.e('页面注册表验证: 首页路由 $route 未注册!');
|
|
}
|
|
}
|