feat(mobile): in-app locale switching
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,21 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
import 'app/app.dart';
|
||||
import 'app/locale_controller.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const ProviderScope(child: PhotoLiveApp()));
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// 启动先读语言偏好再 runApp:首帧即正确语言(无「system 闪变」,
|
||||
// P3 Task 10)。读取失败由 readPersisted 内部兜底为 system。
|
||||
final localeChoice = await LocaleSettings.readPersisted();
|
||||
runApp(
|
||||
ProviderScope(
|
||||
overrides: [
|
||||
localeSettingsProvider.overrideWith(
|
||||
() => LocaleSettings(initial: localeChoice),
|
||||
),
|
||||
],
|
||||
child: const PhotoLiveApp(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user