修改房间选择 详情不更改bug 以及部分样式

This commit is contained in:
czz
2025-07-15 14:53:16 +08:00
parent a8b0723714
commit 8ec4da3488
15 changed files with 117 additions and 51 deletions

View File

@@ -221,7 +221,18 @@ class _BluetoothPageState extends State<BluetoothPage> {
),
_buildMenuButton(
context, '房间选择', "/roomPickerPage",
arguments: obsData),
arguments: obsData, onResult: (result) {
if (result != null && result is Map) {
final Map<String, dynamic> safeMap =
result.map(
(key, value) =>
MapEntry(key.toString(), value),
);
setState(() {
obsData.addAll(safeMap);
});
}
}),
_buildMenuButton(context, '设备校准', ""),
_buildMenuButton(context, '体征传感器', ""),
_buildMenuButton(context, 'WIFI配置', ""),
@@ -313,45 +324,88 @@ 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,
String? path, {
Map<dynamic, dynamic>? arguments,
VoidCallback? onTap,
ValueChanged<dynamic>? onResult, // ✅ 可选返回值处理器
}) {
return Padding(
padding: EdgeInsets.only(bottom: 19.rpx),
child: ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Color(0XFF055466),
highlightColor: const 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: "功能开发中...",
// );
// }
onTap: () async {
if (onTap != null) {
onTap(); // 优先执行自定义逻辑
onTap(); // 自定义点击逻辑优先执行
} else if (path?.isNotEmpty == true) {
if (arguments != null) {
Get.toNamed(path!, arguments: arguments);
} else {
Get.toNamed(path!);
final result = await Get.toNamed(path!, arguments: arguments);
if (result != null && onResult != null) {
onResult(result); // ✅ 有回调就处理返回值
}
} else {
TopSlideNotification.show(
context,
text: "功能开发中...",
);
TopSlideNotification.show(context, text: "功能开发中...");
}
},
child: Container(