USB 摄像头+远程遥控+中英的适配+topic的集成和状态的使用到相应页面

This commit is contained in:
2026-10-20 17:03:37 +08:00
parent 178cd2533c
commit 582242e9aa
144 changed files with 15759 additions and 406 deletions

View File

@@ -38,8 +38,8 @@ class AppLanguages {
}
/// 语言选择弹窗。
/// [mandatory] = true:登录时强制选择,不可返回/点外部关闭;
/// [mandatory] = false:设置页中可随时关闭。
/// [mandatory] = true:登录时强制弹出,拦截系统返回键;可点某个语言即时切换,或点“继续”确认当前默认语言后关闭。
/// [mandatory] = false:设置页中普通选择,可取消。
class LanguageSelectionDialog extends StatelessWidget {
final bool mandatory;
const LanguageSelectionDialog({super.key, this.mandatory = true});
@@ -49,6 +49,12 @@ class LanguageSelectionDialog extends StatelessWidget {
if (context.mounted) Navigator.of(context).pop();
}
/// “继续”:不改变当前(默认)语言,仅确认已选并关闭,后续启动不再弹。
Future<void> _onContinue(BuildContext context, Locale current) async {
await context.read<LocaleCubit>().setLocale(current);
if (context.mounted) Navigator.of(context).pop();
}
@override
Widget build(BuildContext context) {
final current = context.select<LocaleCubit, Locale>(
@@ -79,14 +85,15 @@ class LanguageSelectionDialog extends StatelessWidget {
],
),
),
actions: mandatory
? null
: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('取消'),
),
],
actions: [
// 强制弹窗:提供“继续”出口,保持当前默认语言并确认后关闭;非强制:取消
TextButton(
onPressed: () => mandatory
? _onContinue(context, current)
: Navigator.of(context).pop(),
child: Text(mandatory ? '继续 / Continue' : '取消'),
),
],
),
);
}