解绑设备

This commit is contained in:
czz
2025-06-24 15:38:18 +08:00
parent c21896a408
commit 1522f2e4c9
17 changed files with 706 additions and 472 deletions

View File

@@ -6,12 +6,16 @@ import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/mh_controller/device_list_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
class BluetoothPage extends GetView {
Map data;
BluetoothPage({required this.data});
BoxConstraints? bodysize;
DeviceListController deviceListController = Get.find();
@override
Widget build(BuildContext context) {
@@ -156,8 +160,44 @@ class BluetoothPage extends GetView {
_buildMenuButton(
context, '睡眠习惯', "/sleepHabitPage"),
_buildMenuButton(
context, '分享设备', "/deviceSharePage"),
_buildMenuButton(context, '解绑', ""),
context, '分享设备', "/deviceSharePage",
arguments: data),
_buildMenuButton(
context,
data['bind_type'] == 1 ? '解绑' : '删除',
"",
onTap: () {
if (data['bind_type'] == 1) {
// 解绑弹窗
showUnbindConfirmDialog(
context: context,
title: "是否进行解绑?",
onConfirm: () {
deviceListController
.unbindDevice(data);
// 执行解绑逻辑
},
onCancel: () {
// 点击取消后的逻辑
},
);
} else if (data['bind_type'] == 2) {
// 删除弹窗
showDeleteDeviceConfirmDialog(
context: context,
title: "是否进行删除?",
onConfirm: () {
deviceListController.unbindDevice(
data,
);
},
onCancel: () {
// 点击取消后的逻辑
},
);
}
},
),
],
),
),
@@ -168,8 +208,13 @@ class BluetoothPage extends GetView {
});
}
Widget _buildMenuButton(BuildContext context, String title, String? path,
{Map<dynamic, dynamic>? arguments}) {
Widget _buildMenuButton(
BuildContext context,
String title,
String? path, {
Map<dynamic, dynamic>? arguments,
VoidCallback? onTap,
}) {
return Padding(
padding: EdgeInsets.only(bottom: 19.rpx),
child: ClickableContainer(
@@ -177,7 +222,21 @@ class BluetoothPage extends GetView {
highlightColor: Color(0XFF055466),
padding: EdgeInsets.only(left: 0),
onTap: () {
if (path?.isNotEmpty == true) {
// if (path?.isNotEmpty == true) {
// if (arguments != null) {
// Get.toNamed(path!, arguments: arguments);
// } else {
// Get.toNamed(path!);
// }
// } else {
// TopSlideNotification.show(
// context,
// text: "功能开发中...",
// );
// }
if (onTap != null) {
onTap(); // 优先执行自定义逻辑
} else if (path?.isNotEmpty == true) {
if (arguments != null) {
Get.toNamed(path!, arguments: arguments);
} else {