From 682728eb1e611cb7b1cbabfb2759c7c00e1d1321 Mon Sep 17 00:00:00 2001 From: wyf <494641114@qq.com> Date: Thu, 5 Jun 2025 14:01:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=95=8C=E9=9D=A2=E5=B8=83?= =?UTF-8?q?=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home_page/DynamicReportDetailWidget.dart | 11 +- lib/pages/main_bottom/home_page.dart | 150 ++---------------- .../main_bottom/main_page_bottom_change.dart | 3 +- 3 files changed, 22 insertions(+), 142 deletions(-) diff --git a/lib/component/home_page/DynamicReportDetailWidget.dart b/lib/component/home_page/DynamicReportDetailWidget.dart index 4cb025f..658179a 100644 --- a/lib/component/home_page/DynamicReportDetailWidget.dart +++ b/lib/component/home_page/DynamicReportDetailWidget.dart @@ -123,7 +123,9 @@ class _DynamicReportDetailWidgetState extends State { "${ServiceConstant.sleep_report_url}?mac=$mac&token=${ServiceConstant.sleep_token}&date=$time"; Get.toNamed("/sleepReportPage", arguments: sleepReportUrl); } else { - TopSlideNotification.show(context,text: "当前暂无数据".tr,textColor: themeController.currentColor.sc9); + TopSlideNotification.show(context, + text: "当前暂无数据".tr, + textColor: themeController.currentColor.sc9); } }, child: Row( @@ -199,4 +201,11 @@ class _DynamicReportDetailWidgetState extends State { ), ); } + + void resetScroll() { + _hasScrolled = false; + if (_scrollController.hasClients) { + _scrollController.jumpTo(0); + } + } } diff --git a/lib/pages/main_bottom/home_page.dart b/lib/pages/main_bottom/home_page.dart index 8aca206..8ecb47b 100644 --- a/lib/pages/main_bottom/home_page.dart +++ b/lib/pages/main_bottom/home_page.dart @@ -211,144 +211,6 @@ class _HomePageState extends State { WidgetsBinding.instance.addPostFrameCallback((_) { userInfoController.device_bind_flag = 1; 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 { // bodyDeviceController = Get.find(); // bodyDeviceController.model.type = 1; // Get.toNamed("/bodyDevice"); + homeController.model.type = 1; deviceController.model.type = 1; await deviceController @@ -1140,7 +1003,6 @@ class _HomePageState extends State { var deviceList = deviceController.deviceList.value .where((device) => device['show'] == true) .toList(); - if (deviceList.isEmpty) { return Expanded(child: NullDataWidget()); } @@ -1156,7 +1018,10 @@ class _HomePageState extends State { .toList(); if (macList.length != deviceList.length) { return Expanded( - child: Center(child: CircularProgressIndicator()), + child: Center( + child: CircularProgressIndicator( + color: themeController.currentColor.sc1, + )), ); } @@ -1176,6 +1041,8 @@ class _HomePageState extends State { List stateModule = []; String currentTime = ""; return DynamicReportDetailWidget( + key: ValueKey( + '${targetDevice!['mac']}_${homeController.model.type}'), // 添加唯一key targetDevice: targetDevice!, sleepDateWidgets: List.generate( dailyDataList.length, @@ -1299,6 +1166,9 @@ class _HomePageState extends State { var data = device_bind_process[currentIndex]; PersonController personController = Get.find(); personController.after_deveice = data['device_info']; + BlueteethBindController blueteethBindController = Get.find(); + blueteethBindController.currentDeviceMac!.value = + data['device_info']['mac']; // 判断逻辑... if (data['wifi'] == false) { await Get.toNamed("/afterWifiPagePerson", diff --git a/lib/pages/main_bottom/main_page_bottom_change.dart b/lib/pages/main_bottom/main_page_bottom_change.dart index a0acc6e..cd6275b 100644 --- a/lib/pages/main_bottom/main_page_bottom_change.dart +++ b/lib/pages/main_bottom/main_page_bottom_change.dart @@ -153,7 +153,7 @@ class MainPageBottomChange extends GetView { Get.back(); } Future.delayed(Duration(milliseconds: 100), () { - Get.toNamed("/loginPage"); + Get.toNamed("/otherLoginPage"); }); }); return; @@ -169,6 +169,7 @@ class MainPageBottomChange extends GetView { controller.updateAll(); }); }, + items: [ getBottomNavigationBarItem("assets/img/menu/home.svg", "assets/img/menu/n_home.svg", "菜单.首页".tr),