基本完成APP的所有页面中的语言切换支持的开发和设计

This commit is contained in:
2026-04-24 15:24:43 +08:00
parent ba4519125e
commit 2e241cb9f5
26 changed files with 649 additions and 416 deletions

View File

@@ -2,6 +2,7 @@ import 'package:cc_ui_kit/cc_ui_kit.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
import '../bloc/remote_control_cubit.dart';
import 'emergency_stop_button.dart';
@@ -41,7 +42,7 @@ class CenterControlArea extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
_buildSliderBox(expandedWidth, "底盘", true,context),
_buildSliderBox(expandedWidth, AppLocalizations.of(context).translate('remote_control.chassis'), true,context),
SizedBox(height: totalWidth * 0.01),
],
),
@@ -57,9 +58,9 @@ class CenterControlArea extends StatelessWidget {
SizedBox(height: totalWidth * 0.05),
const Text(
'双击空白处切换视角',
style: TextStyle(fontSize: 8, color: Colors.grey),
Text(
AppLocalizations.of(context).translate('remote_control.switch_view_hint'),
style: const TextStyle(fontSize: 8, color: Colors.grey),
),
],
),
@@ -71,7 +72,7 @@ class CenterControlArea extends StatelessWidget {
width: expandedWidth,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [_buildSliderBox(expandedWidth, "割刀", false,context)],
children: [_buildSliderBox(expandedWidth, AppLocalizations.of(context).translate('remote_control.mower'), false,context)],
),
),
],
@@ -93,7 +94,9 @@ class CenterControlArea extends StatelessWidget {
svgStart: "assets/svgs/remote_up.svg",
svgCenter: switch (label) {
"割刀" => "assets/svgs/remote_scissors.svg",
"Mower" => "assets/svgs/remote_scissors.svg",
"底盘" => "assets/svgs/remote_layers.svg",
"Chassis" => "assets/svgs/remote_layers.svg",
_ => "assets/svgs/remote_layers.svg", // 下划线表示默认值
},
svgEnd: "assets/svgs/remote_down.svg",
@@ -111,12 +114,15 @@ class CenterControlArea extends StatelessWidget {
void _handleSliderAction(String label, String action, BuildContext context) {
debugPrint('🎯 [Slider 业务] label: $label, action: $action');
final loc = AppLocalizations.of(context);
// 🔥 根据 label 区分不同的设备
switch (label) {
case "底盘":
case "Chassis":
_handleChassisAction(action, context);
break;
case "割刀":
case "Mower":
_handleMowerAction(action, context);
break;
default: