2026-09-19 00:22:04 +08:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2026-09-23 16:05:53 +08:00
|
|
|
import 'package:fluwx/fluwx.dart';
|
2026-09-19 00:22:04 +08:00
|
|
|
|
|
|
|
|
import 'app/app.dart';
|
2026-09-19 05:00:11 +08:00
|
|
|
import 'app/locale_controller.dart';
|
2026-09-19 00:22:04 +08:00
|
|
|
|
2026-09-19 05:00:11 +08:00
|
|
|
Future<void> main() async {
|
|
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
2026-09-23 16:05:53 +08:00
|
|
|
// 微信 SDK(卡片分享):WECHAT_APPID 经 --dart-define 注入(微信开放平台
|
|
|
|
|
// 注册的应用 ID);未配置(空)时跳过注册——分享回退系统分享面板。
|
|
|
|
|
// Android 需保证打包签名与微信平台注册签名一致,否则拉不起微信。
|
|
|
|
|
const wechatAppId = String.fromEnvironment('WECHAT_APPID');
|
|
|
|
|
if (wechatAppId.isNotEmpty) {
|
|
|
|
|
await Fluwx().registerApi(appId: wechatAppId, doOnIOS: false);
|
|
|
|
|
}
|
2026-09-19 05:00:11 +08:00
|
|
|
// 启动先读语言偏好再 runApp:首帧即正确语言(无「system 闪变」,
|
|
|
|
|
// P3 Task 10)。读取失败由 readPersisted 内部兜底为 system。
|
|
|
|
|
final localeChoice = await LocaleSettings.readPersisted();
|
|
|
|
|
runApp(
|
|
|
|
|
ProviderScope(
|
|
|
|
|
overrides: [
|
|
|
|
|
localeSettingsProvider.overrideWith(
|
|
|
|
|
() => LocaleSettings(initial: localeChoice),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
child: const PhotoLiveApp(),
|
|
|
|
|
),
|
|
|
|
|
);
|
2026-09-19 00:22:04 +08:00
|
|
|
}
|