修改房间选择 详情不更改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

@@ -49,4 +49,5 @@ class AppConstants {
//系统参数
//运行打包APP模式
int ent_type = APPPackageType.MHT.code; //1.默认太和 2.欢睡 3.眠花糖
int text_length = 8;
}

View File

@@ -59,7 +59,7 @@ class _HomeDeviceTypeState extends State<HomeDeviceType> {
// 左侧图标
Positioned(
left: 0.rpx,
child: returnIconButtom,
child: returnIconButtomNew,
),
],
),

View File

@@ -140,7 +140,7 @@ class ShareDeviceDetailWidget extends GetView {
MainAxisAlignment.spaceBetween,
children: [
Text(
'允许对方控制该设备'.tr,
'允许对方控制和查看该设备'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(

View File

@@ -78,7 +78,7 @@ class ShareUserWidget extends GetView {
alignment: const AlignmentDirectional(-1, 0),
child: Text(
info['op_type'] == 1
? '允许对方控制该设备'.tr
? '允许对方控制和查看该设备'.tr
: info['op_type'] == 2
? '仅允许对方查看该设备'.tr
: '',

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(

View File

@@ -117,9 +117,11 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
});
}
WidgetsBinding.instance.addPostFrameCallback((_) {
if (homeController.homeSleepDays.value.isNotEmpty) {
if (homeController
.homeSleepDays.value.isNotEmpty) {
homeController.selectedDayIndex.value =
homeController.homeSleepDays.value.length - 1;
homeController.homeSleepDays.value.length -
1;
}
});
Get.until((route) =>
@@ -239,11 +241,11 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
borderRadius:
AppConstants().normal_container_radius, // 圆角半径
onTap: () async {
TopSlideNotification.show(
context,
text: "功能开发中...",
);
return;
// TopSlideNotification.show(
// context,
// text: "功能开发中...",
// );
// return;
PersonController personController = Get.find();
String deviceID =
personController.currentPersonId.value;
@@ -347,9 +349,11 @@ class _MHTBindDeviceSuccessState extends State<MHTBindDeviceSuccess> {
});
}
WidgetsBinding.instance.addPostFrameCallback((_) {
if (homeController.homeSleepDays.value.isNotEmpty) {
if (homeController
.homeSleepDays.value.isNotEmpty) {
homeController.selectedDayIndex.value =
homeController.homeSleepDays.value.length - 1;
homeController.homeSleepDays.value.length -
1;
}
});
Get.until((route) =>

View File

@@ -87,7 +87,7 @@ class _MHTBindDeviceTypePageState extends State<MHTBindDeviceTypePage> {
/// 左边返回按钮
Positioned(
left: 0,
child: returnIconButtom,
child: returnIconButtomNew,
),
],
),

View File

@@ -39,7 +39,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
// Initialize person A
peopleList.add({
'mac': device?.macA,
'gender': "",
'gender': 1,
'id': device!.macAID,
});
@@ -47,7 +47,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
if (device?.macB != null && device!.macB!.isNotEmpty) {
peopleList.add({
'mac': device.macB,
'gender': "",
'gender': 1,
'id': device!.macBID,
});
}
@@ -326,7 +326,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
: 1, checkChange: (sindex) {
setState(() {
peopleList[index]['gender'] =
sindex == 0 ? "" : "";
sindex;
});
}).then((d) {});
});
@@ -351,7 +351,7 @@ class _MHTPeopleInfoPageState extends State<MHTPeopleInfoPage> {
Container(
width: 200.rpx,
child: Text(
'${peopleList[index]['gender']}',
'${peopleList[index]['gender'] == 1 ? '' : ''}',
textAlign: TextAlign.right,
style: TextStyle(
fontFamily: 'Readex Pro',

View File

@@ -142,6 +142,7 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
key: _formKey,
child: TextFormField(
controller: _phoneController,
textAlign: TextAlign.center,
decoration: InputDecoration(
hintText: '请输入对方手机号/邮箱号',
hintStyle: TextStyle(
@@ -234,7 +235,7 @@ class ShareDeviceWidget extends GetView<MHDeviceShareController> {
MainAxisAlignment.spaceBetween,
children: [
Text(
'允许对方控制该设备'.tr,
'允许对方控制和查看该设备'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
color: Colors.white,

View File

@@ -405,6 +405,8 @@ class EditAddressPage extends GetView<AddressController>
0),
child:
TextFormField(
initialValue:
address['name'],
onChanged:
(value) {
controller.model.name =
@@ -495,7 +497,6 @@ class EditAddressPage extends GetView<AddressController>
),
),
),
].divide(const SizedBox(
width: 15)),
),
@@ -589,6 +590,8 @@ class EditAddressPage extends GetView<AddressController>
0),
child:
TextFormField(
initialValue:
address['tel'],
onChanged:
(value) {
controller.model.tel =

View File

@@ -1,6 +1,7 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
@@ -121,9 +122,10 @@ class _EditBedPageState extends State<EditBedPage> {
editedData['name'] = val;
},
textAlign: TextAlign.center,
maxLength: AppConstants().text_length,
decoration: InputDecoration(
hintText: "请输入设备的名称",
// counterText: "",
contentPadding:
const EdgeInsetsDirectional
.fromSTEB(10, 0, 10, 0),

View File

@@ -147,7 +147,7 @@ class _MinePageState extends State<NewMinePage> {
userInfoController
.model.user!.avatar!.isEmpty
? Image.asset(
"assets/images/default_avatar.png",
"assets/images/mine_avatar.png",
fit: BoxFit.cover,
)
: Image.network(
@@ -156,7 +156,7 @@ class _MinePageState extends State<NewMinePage> {
fit: BoxFit.cover,
))
: Image.asset(
"assets/images/default_avatar.png",
"assets/images/mine_avatar.png",
fit: BoxFit.cover,
),
),

View File

@@ -43,7 +43,7 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
);
}
int selectedIndex = 1;
int selectedIndex = 0;
BoxConstraints? bodysize;
@override
Widget build(BuildContext context) {
@@ -189,7 +189,8 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
"roomId": rooms[selectedIndex]['_id'],
},
onSuccess: (res) {
editedData['roomName'] =
rooms[selectedIndex]['name'];
TopSlideNotification.show(context,
text: "更新成功".tr,
textColor: Color(0XFF00C1AA));
@@ -202,7 +203,7 @@ class _RoomPickerPageState extends State<RoomPickerPage> {
} catch (e) {
ef.log("[h5]通知列表更新错误:$e");
}
Get.back(result:editedData);
Get.back(result: editedData);
},
onFailure: (res) {
TopSlideNotification.show(context,

View File

@@ -213,7 +213,7 @@ class _RxhxMhtState extends State<RxhxMht> {
),
// 左侧图标
Positioned(
left: 20.rpx,
left: 0.rpx,
child: returnIconButtomNew,
),
],