分享设备用户列表

This commit is contained in:
czz
2025-07-23 13:55:46 +08:00
parent e80011161c
commit 1356eb9e19
61 changed files with 648 additions and 568 deletions

View File

@@ -28,37 +28,8 @@ class _BluetoothPageState extends State<BluetoothPage> {
void initState() {
super.initState();
obsData = Map<String, dynamic>.from(widget.data).obs; // 复制成 obs
// String text;
// if (obsData.containsKey('name') &&
// obsData['name'] != null &&
// obsData['name'].toString().isNotEmpty) {
// text = obsData['name'].toString();
// } else {
// text = '未命名'.tr;
// }
// _calculateTextHalfWidth(text);
}
// void _calculateTextHalfWidth(String text) {
// final textSpan = TextSpan(
// text: text,
// style: TextStyle(
// fontSize: 40.rpx,
// height: 1,
// ),
// );
// final textPainter = TextPainter(
// text: textSpan,
// textDirection: ui.TextDirection.ltr,
// );
// textPainter.layout(); // 计算文本宽度
// setState(() {
// _textHalfWidth = textPainter.width / 2;
// });
// }
BoxConstraints? bodysize;
DeviceListController deviceListController = Get.find();
@override
@@ -100,7 +71,7 @@ class _BluetoothPageState extends State<BluetoothPage> {
// 左侧图标
Positioned(
left: 0.rpx,
child: returnIconButtomNew,
child: returnIconButtomNew(),
),
],
),
@@ -236,11 +207,21 @@ class _BluetoothPageState extends State<BluetoothPage> {
});
}
}),
_buildMenuButton(context, '设备校准', "/mhtCalibrationAfterPage", arguments: obsData,),
_buildMenuButton(
context,
'设备校准',
"/mhtCalibrationAfterPage",
arguments: obsData,
),
_buildMenuButton(
context, '体征传感器', "/vitalSignsSensorPage",
arguments: obsData),
_buildMenuButton(context, 'WIFI配置', "/mhtWifiAfterPage",arguments: obsData,),
_buildMenuButton(
context,
'WIFI配置',
"/mhtWifiAfterPage",
arguments: obsData,
),
// _buildMenuButton(
// context, '睡眠习惯', "/sleepHabitPage"),
_buildMenuButton(
@@ -252,7 +233,25 @@ class _BluetoothPageState extends State<BluetoothPage> {
context,
obsData['bind_type'] == 1 ? '解绑' : '删除',
"",
onTap: () {/*...*/},
onTap: () async {
await deviceListController
.unbindDevice(obsData);
await deviceListController
.getDeviceList();
MHTHomeController homeController =
Get.find();
homeController.selectDevcie.value = "";
try {
WebviewTestController
webviewTestController = Get.find();
webviewTestController.web.jsbridge?.dart
.unBindDevice();
} catch (e) {
ef.log("[h5]通知列表更新报错:$e");
}
Get.toNamed("/mianPageBottomChange");
},
),
_buildMenuButton(
context, '详情', "/devicePeopleInfo",
@@ -330,64 +329,6 @@ class _BluetoothPageState extends State<BluetoothPage> {
});
}
// Widget _buildMenuButton(
// BuildContext context,
// String title,
// String? path, {
// Map<dynamic, dynamic>? arguments,
// VoidCallback? onTap,
// }) {
// return Padding(
// padding: EdgeInsets.only(bottom: 19.rpx),
// child: ClickableContainer(
// backgroundColor: Colors.transparent,
// highlightColor: Color(0XFF055466),
// padding: EdgeInsets.only(left: 0),
// onTap: () {
// // 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 {
// Get.toNamed(path!);
// }
// } else {
// TopSlideNotification.show(
// context,
// text: "功能开发中...",
// );
// }
// },
// child: Container(
// height: MediaQuery.sizeOf(context).height * 0.0566,
// decoration: BoxDecoration(
// color: const Color(0xFF003058),
// borderRadius: BorderRadius.circular(16.rpx),
// ),
// child: Center(
// child: Text(
// title,
// style: const TextStyle(color: Colors.white, fontSize: 16),
// ),
// ),
// ),
// ),
// );
// }
Widget _buildMenuButton(
BuildContext context,
String title,
@@ -401,14 +342,15 @@ class _BluetoothPageState extends State<BluetoothPage> {
child: ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: const Color(0XFF055466),
borderRadius: 16.rpx,
padding: EdgeInsets.only(left: 0),
onTap: () async {
if (onTap != null) {
onTap(); // 自定义点击逻辑优先执行
} else if (path?.isNotEmpty == true) {
if (path == "/sleepHabitPage") {
if (path == "/sleepHabitPage") {
WebviewTestController webviewTestController = Get.find();
webviewTestController.web.jsbridge?.dart.toSleepHabit();
webviewTestController.web.jsbridge?.dart.toSleepHabit();
return;
}
final result = await Get.toNamed(path!, arguments: arguments);