更新界面布局

This commit is contained in:
wyf
2025-06-05 14:01:48 +08:00
parent 857317caf1
commit 682728eb1e
3 changed files with 22 additions and 142 deletions

View File

@@ -123,7 +123,9 @@ class _DynamicReportDetailWidgetState extends State<DynamicReportDetailWidget> {
"${ServiceConstant.sleep_report_url}?mac=$mac&token=${ServiceConstant.sleep_token}&date=$time"; "${ServiceConstant.sleep_report_url}?mac=$mac&token=${ServiceConstant.sleep_token}&date=$time";
Get.toNamed("/sleepReportPage", arguments: sleepReportUrl); Get.toNamed("/sleepReportPage", arguments: sleepReportUrl);
} else { } else {
TopSlideNotification.show(context,text: "当前暂无数据".tr,textColor: themeController.currentColor.sc9); TopSlideNotification.show(context,
text: "当前暂无数据".tr,
textColor: themeController.currentColor.sc9);
} }
}, },
child: Row( child: Row(
@@ -199,4 +201,11 @@ class _DynamicReportDetailWidgetState extends State<DynamicReportDetailWidget> {
), ),
); );
} }
void resetScroll() {
_hasScrolled = false;
if (_scrollController.hasClients) {
_scrollController.jumpTo(0);
}
}
} }

View File

@@ -211,144 +211,6 @@ class _HomePageState extends State<HomePage> {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
userInfoController.device_bind_flag = 1; userInfoController.device_bind_flag = 1;
checkAndShowBindProcess(); checkAndShowBindProcess();
// List device_bind_process = userInfoController.device_bind_status;
// if (device_bind_process != null && device_bind_process.isNotEmpty) {
// int currentIndex = 0;
// void showNextDialog() {
// if (currentIndex >= device_bind_process.length) return;
// String code = device_bind_process[currentIndex]['mac'];
// showUnBindTipDialog(
// context,
// Column(
// children: [
// Text(
// "发现".tr,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc3,
// ),
// ),
// SizedBox(height: 20.rpx),
// Text.rich(
// TextSpan(
// children: [
// TextSpan(
// text: "检测到".tr,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc3,
// ),
// ),
// TextSpan(
// text: code,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc8,
// ),
// ),
// TextSpan(
// text: "绑定流程未走完是否继续?".tr,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc3,
// ),
// ),
// ],
// ),
// ),
// ],
// ),
// onConfirm: () async {
// print("继续设备:$code");
// var data = device_bind_process[currentIndex];
// BlueteethBindController blueteethBindController = Get.find();
// blueteethBindController.currentDeviceMac?.value = data['mac'];
// PersonController personController = Get.find();
// personController.after_deveice = data['device_info'];
// // 从 WiFi 开始配置
// if (data['wifi'] == false) {
// await Get.toNamed("/afterWifiPagePerson",
// arguments: data['device_info'])!
// .then((_) {
// currentIndex++;
// showNextDialog(); // 👈 返回后继续弹窗流程
// });
// return;
// }
// // 从设备校准开始配置
// if (data['celibration'] == false) {
// await Get.toNamed("/afterCalibrationPersonPage")!.then((_) {
// currentIndex++;
// showNextDialog(); // 👈 返回后继续弹窗流程
// });
// return;
// }
// // 从人员信息配置开始
// if (data['person_info'] == false) {
// if (data['device_info']['person'] != null) {
// personController.currentPersonId.value =
// data['device_info']['_id'];
// personController.name.value =
// data['device_info']['person']['name'];
// personController.update_person_mac.value =
// data['device_info']['mac'];
// personController.gender.value =
// data['device_info']['person']['gender'] ?? 1;
// personController.weight?.value =
// data['device_info']['person']['weight']?.toString() ??
// '';
// personController.height.value =
// data['device_info']['person']['height']?.toString() ??
// '';
// personController.selectedDiseaseIds.value =
// data['device_info']['person']['disease'] ?? [];
// personController.birthday.value =
// data['device_info']['person']['birthday'] ?? '';
// personController.dateTime = MyUtils.formatBirthdayTime(
// data['device_info']['person']['birthday']);
// } else {
// personController.update_person_mac.value =
// data['device_info']['mac'];
// personController.currentPersonId.value =
// data['device_info']['_id'];
// personController.name.value = "";
// personController.gender.value = 1;
// personController.dateTime = null;
// personController.height.value = "";
// personController.weight.value = "";
// personController.diseaseList.value = [];
// }
// await Get.toNamed("/afterUpdatePersonPage")!.then((_) {
// currentIndex++;
// showNextDialog(); // 👈 返回后继续弹窗流程
// });
// return;
// }
// // 如果以上都走完了,继续下一个弹窗
// currentIndex++;
// showNextDialog();
// },
// onCancel: () {
// print("跳过设备:$code");
// device_bind_process.removeAt(currentIndex);
// showNextDialog();
// },
// );
// }
// showNextDialog();
// }
}); });
}); });
} }
@@ -1016,6 +878,7 @@ class _HomePageState extends State<HomePage> {
// bodyDeviceController = Get.find(); // bodyDeviceController = Get.find();
// bodyDeviceController.model.type = 1; // bodyDeviceController.model.type = 1;
// Get.toNamed("/bodyDevice"); // Get.toNamed("/bodyDevice");
homeController.model.type = 1; homeController.model.type = 1;
deviceController.model.type = 1; deviceController.model.type = 1;
await deviceController await deviceController
@@ -1140,7 +1003,6 @@ class _HomePageState extends State<HomePage> {
var deviceList = deviceController.deviceList.value var deviceList = deviceController.deviceList.value
.where((device) => device['show'] == true) .where((device) => device['show'] == true)
.toList(); .toList();
if (deviceList.isEmpty) { if (deviceList.isEmpty) {
return Expanded(child: NullDataWidget()); return Expanded(child: NullDataWidget());
} }
@@ -1156,7 +1018,10 @@ class _HomePageState extends State<HomePage> {
.toList(); .toList();
if (macList.length != deviceList.length) { if (macList.length != deviceList.length) {
return Expanded( return Expanded(
child: Center(child: CircularProgressIndicator()), child: Center(
child: CircularProgressIndicator(
color: themeController.currentColor.sc1,
)),
); );
} }
@@ -1176,6 +1041,8 @@ class _HomePageState extends State<HomePage> {
List stateModule = []; List stateModule = [];
String currentTime = ""; String currentTime = "";
return DynamicReportDetailWidget( return DynamicReportDetailWidget(
key: ValueKey(
'${targetDevice!['mac']}_${homeController.model.type}'), // 添加唯一key
targetDevice: targetDevice!, targetDevice: targetDevice!,
sleepDateWidgets: List.generate( sleepDateWidgets: List.generate(
dailyDataList.length, dailyDataList.length,
@@ -1299,6 +1166,9 @@ class _HomePageState extends State<HomePage> {
var data = device_bind_process[currentIndex]; var data = device_bind_process[currentIndex];
PersonController personController = Get.find(); PersonController personController = Get.find();
personController.after_deveice = data['device_info']; personController.after_deveice = data['device_info'];
BlueteethBindController blueteethBindController = Get.find();
blueteethBindController.currentDeviceMac!.value =
data['device_info']['mac'];
// 判断逻辑... // 判断逻辑...
if (data['wifi'] == false) { if (data['wifi'] == false) {
await Get.toNamed("/afterWifiPagePerson", await Get.toNamed("/afterWifiPagePerson",

View File

@@ -153,7 +153,7 @@ class MainPageBottomChange extends GetView<MainPageController> {
Get.back(); Get.back();
} }
Future.delayed(Duration(milliseconds: 100), () { Future.delayed(Duration(milliseconds: 100), () {
Get.toNamed("/loginPage"); Get.toNamed("/otherLoginPage");
}); });
}); });
return; return;
@@ -169,6 +169,7 @@ class MainPageBottomChange extends GetView<MainPageController> {
controller.updateAll(); controller.updateAll();
}); });
}, },
items: [ items: [
getBottomNavigationBarItem("assets/img/menu/home.svg", getBottomNavigationBarItem("assets/img/menu/home.svg",
"assets/img/menu/n_home.svg", "菜单.首页".tr), "assets/img/menu/n_home.svg", "菜单.首页".tr),