diff --git a/assets/svgs/fire.svg b/assets/svgs/fire.svg
new file mode 100644
index 00000000..7772efda
--- /dev/null
+++ b/assets/svgs/fire.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/svgs/remote_flame.svg b/assets/svgs/remote_flame.svg
index 7772efda..9414b2a1 100644
--- a/assets/svgs/remote_flame.svg
+++ b/assets/svgs/remote_flame.svg
@@ -1 +1,6 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/assets/svgs/remote_flame_minus.svg b/assets/svgs/remote_flame_minus.svg
index d9fa11d0..48aa9b80 100644
--- a/assets/svgs/remote_flame_minus.svg
+++ b/assets/svgs/remote_flame_minus.svg
@@ -2,24 +2,26 @@
width="24"
height="24"
viewBox="0 0 24 24">
+
+
+
+
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/assets/svgs/remote_flame_plus.svg b/assets/svgs/remote_flame_plus.svg
index ac7ee1ad..03cd067e 100644
--- a/assets/svgs/remote_flame_plus.svg
+++ b/assets/svgs/remote_flame_plus.svg
@@ -2,32 +2,34 @@
width="24"
height="24"
viewBox="0 0 24 24">
+
+
+
+
-
-
+
+
-
-
-
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/assets/svgs/scissors.svg b/assets/svgs/scissors.svg
new file mode 100644
index 00000000..1c4e26ed
--- /dev/null
+++ b/assets/svgs/scissors.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/lib/features/remote_control/presentation/widgets/center_control_area.dart b/lib/features/remote_control/presentation/widgets/center_control_area.dart
index cb53ce8e..d06001db 100644
--- a/lib/features/remote_control/presentation/widgets/center_control_area.dart
+++ b/lib/features/remote_control/presentation/widgets/center_control_area.dart
@@ -40,7 +40,7 @@ class CenterControlArea extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
- _buildSliderBox(expandedWidth, "底盘", true),
+ _buildSliderBox(expandedWidth, "底盘", true,context),
SizedBox(height: totalWidth * 0.01),
],
),
@@ -70,7 +70,7 @@ class CenterControlArea extends StatelessWidget {
width: expandedWidth,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
- children: [_buildSliderBox(expandedWidth, "割刀", false)],
+ children: [_buildSliderBox(expandedWidth, "割刀", false,context)],
),
),
],
@@ -80,7 +80,7 @@ class CenterControlArea extends StatelessWidget {
);
}
- Widget _buildSliderBox(double boxWidth, String label, bool isLeft) {
+ Widget _buildSliderBox(double boxWidth, String label, bool isLeft,BuildContext context) {
return SizedBox(
width: boxWidth,
child: Center(
@@ -90,10 +90,14 @@ class CenterControlArea extends StatelessWidget {
child: CCExpandSlider(
label: label,
svgStart: "assets/svgs/remote_up.svg",
- svgCenter: "assets/svgs/remote_layers.svg",
+ svgCenter: switch (label) {
+ "割刀" => "assets/svgs/remote_scissors.svg",
+ "底盘" => "assets/svgs/remote_layers.svg",
+ _ => "assets/svgs/remote_layers.svg", // 下划线表示默认值
+ },
svgEnd: "assets/svgs/remote_down.svg",
- onStart: () => debugPrint("$label start"),
- onCenter: () => debugPrint("$label center"),
+ onStart: () => _handleSliderAction(label, "start", context),
+ onCenter: () => _handleSliderAction(label, "center", context),
onEnd: () => debugPrint("$label end"),
iconSize: boxWidth * 0.6 * 0.35,
),
@@ -101,4 +105,67 @@ class CenterControlArea extends StatelessWidget {
),
);
}
+
+ // 🔥 新增:统一的业务逻辑分发方法
+ void _handleSliderAction(String label, String action, BuildContext context) {
+ debugPrint('🎯 [Slider 业务] label: $label, action: $action');
+
+ // 🔥 根据 label 区分不同的设备
+ switch (label) {
+ case "底盘":
+ _handleChassisAction(action, context);
+ break;
+ case "割刀":
+ _handleMowerAction(action, context);
+ break;
+ default:
+ debugPrint('⚠️ 未知的 label: $label');
+ }
+ }
+
+ // 🔥 底盘的业务逻辑(左滑块)
+ void _handleChassisAction(String action, BuildContext context) {
+ final cubit = context.read();
+
+ switch (action) {
+ case "start":
+ debugPrint('⬆️ 底盘 - 向上(例如:前进)');
+ // TODO: 发送底盘前进指令
+ // cubit.sendChassisCommand(ChassisCommand.forward);
+ break;
+ case "center":
+ debugPrint('️ 底盘 - 中间(例如:停止)');
+ // TODO: 发送底盘停止指令
+ // cubit.sendChassisCommand(ChassisCommand.stop);
+ break;
+ case "end":
+ debugPrint('⬇️ 底盘 - 向下(例如:后退)');
+ // TODO: 发送底盘后退指令
+ // cubit.sendChassisCommand(ChassisCommand.backward);
+ break;
+ }
+ }
+
+ // 🔥 割刀的业务逻辑(右滑块)
+ void _handleMowerAction(String action, BuildContext context) {
+ final cubit = context.read();
+
+ switch (action) {
+ case "start":
+ debugPrint('⬆️ 割刀 - 向上(例如:抬刀)');
+ // TODO: 发送抬刀指令
+ // cubit.sendMowerCommand(MowerCommand.lift);
+ break;
+ case "center":
+ debugPrint('⏹️ 割刀 - 中间(例如:保持)');
+ // TODO: 发送保持指令
+ // cubit.sendMowerCommand(MowerCommand.hold);
+ break;
+ case "end":
+ debugPrint('⬇️ 割刀 - 向下(例如:降刀)');
+ // TODO: 发送降刀指令
+ // cubit.sendMowerCommand(MowerCommand.lower);
+ break;
+ }
+ }
}
diff --git a/lib/features/remote_control/presentation/widgets/top_status_bar.dart b/lib/features/remote_control/presentation/widgets/top_status_bar.dart
index e74d1db4..4960210a 100644
--- a/lib/features/remote_control/presentation/widgets/top_status_bar.dart
+++ b/lib/features/remote_control/presentation/widgets/top_status_bar.dart
@@ -4,6 +4,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:maibu_satabot_v2/features/remote_control/presentation/bloc/remote_control_state.dart';
import 'package:maibu_satabot_v2/features/remote_control/presentation/widgets/status_chip.dart';
+import 'package:cc_ui_kit/cc_ui_kit.dart';
import '../../../devices/presentation/bloc/devices_cubit.dart';
import '../bloc/remote_control_cubit.dart';
@@ -73,8 +74,12 @@ class TopStatusBar extends StatelessWidget {
// 4. 刷新按钮
_buildIconButton("assets/svgs/remote_refresh.svg", () {}),
+ const SizedBox(width: 25),
+ // 5. 火技能按钮 (对应 SmallFunctionButton)
+ //_buildIconButton("assets/svgs/fire.svg", () {}),
+ _buildSliderBox("割刀", false,context),
- const Spacer(),
+ const Spacer(),
// TODO
_buildControlModeChip( _parseControlMode(remoteState.runningStatusModel.controlMode)),
@@ -207,4 +212,70 @@ class TopStatusBar extends StatelessWidget {
svgPath: svgPath,
);
}
+
+ Widget _buildSliderBox(String label, bool isLeft, BuildContext context) {
+ // 1. 核心尺寸调整:足够宽的容器解决拥挤,高度匹配状态栏
+ const double boxWidth = 96; // 水平宽度放大,容纳左右图标
+ const double boxHeight = 32; // 高度和其他按钮保持一致
+ const double iconSize = 20; // 图标尺寸放大,避免过小拥挤
+
+ return SizedBox(
+ width: boxWidth,
+ height: boxHeight,
+ child: Center(
+ // 2. 关键:旋转组件将竖向CCExpandSlider转为水平(无direction参数的替代方案)
+ child: RotatedBox(
+ quarterTurns: 1, // 旋转90度(竖向→横向),若方向反了可改为3
+ child: SizedBox(
+ // 旋转后宽高互换,这里给CCExpandSlider足够的显示空间
+ width: boxHeight, // 旋转后对应原高度
+ height: boxWidth, // 旋转后对应原宽度(足够长,不拥挤)
+ child: CCExpandSlider(
+ label: " ",
+ // 3. 图标适配旋转后的方向(仍用上下箭头,旋转后变为左右)
+ svgStart: "assets/svgs/remote_flame_minus.svg", // 旋转后→左箭头
+ svgCenter: "assets/svgs/remote_flame.svg",
+ svgEnd: "assets/svgs/remote_flame_plus.svg", // 旋转后→右箭头
+ // 4. 放大图标尺寸,解决拥挤
+ iconSize: iconSize,
+ // 保留原有业务逻辑
+ onStart: () => _handleSliderAction(label, "start", context),
+ onCenter: () => _handleSliderAction(label, "center", context),
+ onEnd: () => debugPrint("$label end"),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+ // 🔥 新增:统一的业务逻辑分发方法
+ void _handleSliderAction(String label, String action, BuildContext context) {
+ debugPrint('🎯 [Slider 业务] label: $label, action: $action');
+
+ // 🔥 根据 label 区分不同的设备
+ _handleChassisAction(action, context);
+ }
+
+ // 🔥 底盘的业务逻辑(左滑块)
+ void _handleChassisAction(String action, BuildContext context) {
+ final cubit = context.read();
+
+ switch (action) {
+ case "start":
+ debugPrint('⬆️ 底盘 - 向上(例如:前进)');
+ // TODO: 发送底盘前进指令
+ // cubit.sendChassisCommand(ChassisCommand.forward);
+ break;
+ case "center":
+ debugPrint('️ 底盘 - 中间(例如:停止)');
+ // TODO: 发送底盘停止指令
+ // cubit.sendChassisCommand(ChassisCommand.stop);
+ break;
+ case "end":
+ debugPrint('⬇️ 底盘 - 向下(例如:后退)');
+ // TODO: 发送底盘后退指令
+ // cubit.sendChassisCommand(ChassisCommand.backward);
+ break;
+ }
+ }
}