diff --git a/assets/mhlangs/en_US.json b/assets/mhlangs/en_US.json index 4bc42a3..e4da5df 100644 --- a/assets/mhlangs/en_US.json +++ b/assets/mhlangs/en_US.json @@ -646,5 +646,9 @@ "开始": "startTime", "结束": "endTime", "时长": "duration:", - "请选择时区": "Please select a time zone" + "请选择时区": "Please select a time zone", + "邮箱登录": "Email Login", + "慢病管理": "Chronic Disease", + "请选择慢病": "Please select chronic disease", + "获得位置信息,连接附近的蓝牙设备": "Obtain location information, connect to nearby Bluetooth devices" } \ No newline at end of file diff --git a/assets/mhlangs/zh_CN.json b/assets/mhlangs/zh_CN.json index 108dcd5..2bbcc47 100644 --- a/assets/mhlangs/zh_CN.json +++ b/assets/mhlangs/zh_CN.json @@ -169,7 +169,6 @@ "人": "人", "来自": "来自", "的分享": "的分享", - "睡眠报告": "睡眠报告", "未知类型设备": "未知类型设备", "SWES 智能床": "SWES 智能床", "SWES 智能床垫": "SWES 智能床垫", @@ -653,5 +652,9 @@ "开始": "开始", "结束": "结束", "时长": "时长:", - "请选择时区": "请选择时区" + "请选择时区": "请选择时区", + "获得位置信息,连接附近的蓝牙设备": "获得位置信息,连接附近的蓝牙设备", + "慢病管理": "慢病管理", + "请选择慢病": "请选择慢病", + "邮箱登录": "邮箱登录" } \ No newline at end of file diff --git a/assets/mhlangs/zh_TW.json b/assets/mhlangs/zh_TW.json index 45e3be3..88f9bc0 100644 --- a/assets/mhlangs/zh_TW.json +++ b/assets/mhlangs/zh_TW.json @@ -646,5 +646,9 @@ "开始": "開始", "结束": "結束", "时长": "時長:", - "请选择时区": "請選擇時區" + "请选择时区": "請選擇時區", + "邮箱登录": "郵箱登陸", + "慢病管理": "慢病管理", + "请选择慢病": "请选择慢病", + "获得位置信息,连接附近的蓝牙设备": "獲得位置信息,連接附近的藍牙設備" } \ No newline at end of file diff --git a/assets/miniapp/mhtControl_1.0.90.zip b/assets/miniapp/mhtControl_1.0.90.zip index 891e6d2..ce36f8e 100644 Binary files a/assets/miniapp/mhtControl_1.0.90.zip and b/assets/miniapp/mhtControl_1.0.90.zip differ diff --git a/lib/common/pojo/city.dart b/lib/common/pojo/city.dart index aab1327..bd6d612 100644 --- a/lib/common/pojo/city.dart +++ b/lib/common/pojo/city.dart @@ -121,6 +121,19 @@ class CityModelController extends GetControllerEx { return jsonList.map((json) => CityModel.fromJson(json)).toList(); } catch (e) { ef.log("_loadCityData 失败:$e"); + String currentLanguageCode = "en_US"; + + // 根据当前语言代码构建文件名 + final String fileName = 'assets/city/city_$currentLanguageCode.json'; + + // 读取对应语言的JSON文件 + final String jsonString = await rootBundle.loadString(fileName); + + // 解析JSON数据并转换为 CityModel 列表 + final List jsonList = jsonDecode(jsonString); + + // 将 Map 转换为 CityModel + return jsonList.map((json) => CityModel.fromJson(json)).toList(); return []; } } diff --git a/lib/controller/mh_controller/device_list_controller.dart b/lib/controller/mh_controller/device_list_controller.dart index 37bcb2e..85092b8 100644 --- a/lib/controller/mh_controller/device_list_controller.dart +++ b/lib/controller/mh_controller/device_list_controller.dart @@ -5,11 +5,13 @@ import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:json_annotation/json_annotation.dart'; import 'package:vbvs_app/common/color/ServiceConstant.dart'; +import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/app_uri_status.dart'; import 'package:vbvs_app/common/util/DailyLogUtils.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/common/util/requestWithLog.dart'; import 'package:vbvs_app/component/tool/TopSlideNotification.dart'; +import 'package:vbvs_app/enum/APPPackageType.dart'; import 'package:vbvs_app/model/api_response.dart'; part 'device_list_controller.g.dart'; @@ -46,6 +48,23 @@ class DeviceListController extends GetControllerEx { String serviceName = ServiceConstant.server_service; String serviceApi = ServiceConstant.device_list; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}$search"; + String? language = ""; + if (AppConstants().ent_type == APPPackageType.MHT.code) { + if (mhLanguageController.selectLanguage != null) { + language = mhLanguageController.selectLanguage.value!.language_code; + } + } else { + if (languageController.selectLanguage != null) { + language = languageController.selectLanguage.value!.language_code; + } + } + if (language != null && language.isNotEmpty) { + if (queryUrl.contains("?")) { + queryUrl += "&lang=$language"; + } else { + queryUrl += "?lang=$language"; + } + } var response = await EasyDartModule.dio.get(queryUrl); if (response != null) { var responseData = @@ -80,6 +99,23 @@ class DeviceListController extends GetControllerEx { String serviceApi = ServiceConstant.device_list; String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?bindType=1&mac=$mac"; + String? language = ""; + if (AppConstants().ent_type == APPPackageType.MHT.code) { + if (mhLanguageController.selectLanguage != null) { + language = mhLanguageController.selectLanguage.value!.language_code; + } + } else { + if (languageController.selectLanguage != null) { + language = languageController.selectLanguage.value!.language_code; + } + } + if (language != null && language.isNotEmpty) { + if (queryUrl.contains("?")) { + queryUrl += "&lang=$language"; + } else { + queryUrl += "?lang=$language"; + } + } var response = await EasyDartModule.dio.get(queryUrl); if (response != null) { var responseData = diff --git a/lib/controller/mh_controller/mh_language_controller.dart b/lib/controller/mh_controller/mh_language_controller.dart index b9a5065..a19d935 100644 --- a/lib/controller/mh_controller/mh_language_controller.dart +++ b/lib/controller/mh_controller/mh_language_controller.dart @@ -102,7 +102,7 @@ class MHLanguageController extends GetControllerEx { // 可选:添加默认语言(如英文)作为后备 languageList.add( MHLanguageModel() - ..filename = 'en-US.json' + ..filename = 'en_US.json' ..language_name = 'English' ..selected = true, // 默认语言为选中状态 ); diff --git a/lib/controller/setting/language/language_controller.dart b/lib/controller/setting/language/language_controller.dart index 3bb2927..cdd7ecf 100644 --- a/lib/controller/setting/language/language_controller.dart +++ b/lib/controller/setting/language/language_controller.dart @@ -91,7 +91,7 @@ class LanguageController extends GetControllerEx { // 可选:添加默认语言(如英文)作为后备 languageList.add( LanguageModel() - ..filename = 'en-US.json' + ..filename = 'en_US.json' ..language_name = 'English' ..selected = true, // 默认语言为选中状态 ); diff --git a/lib/enum/APPPackageType.dart b/lib/enum/APPPackageType.dart index cecd7eb..5a97b84 100644 --- a/lib/enum/APPPackageType.dart +++ b/lib/enum/APPPackageType.dart @@ -3,6 +3,7 @@ enum APPPackageType { HUANSHUI(2, '欢睡'), MHT(3, '眠花糖'), DONGHUA(4, '东华'), + HAIER(5, '海尔'), ; final int code; diff --git a/lib/language/AppLanguage.dart b/lib/language/AppLanguage.dart index 350701d..ca9c8b2 100644 --- a/lib/language/AppLanguage.dart +++ b/lib/language/AppLanguage.dart @@ -110,7 +110,8 @@ class AppLanguage extends Translations { Locale get currentLocale { // final parts = _currentLanguageCode.split('-'); // return Locale(parts[0], parts.length > 1 ? parts[1] : null); - return isChinese()? const Locale('zh', 'CN') : const Locale('en', 'US'); + // return isChinese()? const Locale('zh', 'CN') : const Locale('en', 'US'); + return Locale(_currentLanguageCode); } bool isChinese() { diff --git a/lib/main.dart b/lib/main.dart index 324b0ff..09dc1d8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,6 +73,7 @@ import 'package:vbvs_app/language/AppLanguage.dart'; import 'package:vbvs_app/model/CustomThemeColor.dart'; import 'package:vbvs_app/model/api_response.dart'; import 'package:vbvs_app/model/user_data.dart'; +import 'package:vbvs_app/network/NetworkStatusController.dart'; import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart'; import 'package:vbvs_app/pages/mh_page/MattressControl.dart'; import 'package:vbvs_app/pages/mh_page/device/component/mht_device_calibration_controller.dart'; @@ -867,6 +868,7 @@ class MyApp extends StatelessWidget { supportedLocales: [ Locale('en', 'US'), Locale('zh', 'CN'), + Locale('fr', 'FR'), ], initialRoute: "/mianPageBottomChange", onGenerateRoute: mh_routers_themecontroller.mhonGenerateRoute, @@ -926,6 +928,7 @@ class MyApp extends StatelessWidget { Get.lazyPut(() => CommonMessageSettingController()), Get.lazyPut(() => MHTDeviceUpgradeController()), Get.lazyPut(() => CityModelController()), + Get.lazyPut(() => NetworkStatusController()), ])); } @@ -1015,7 +1018,7 @@ class MyApp extends StatelessWidget { }); } - getAPPName() { + getAPPName() { switch (AppConstants().ent_type) { case 1: return "太和"; diff --git a/lib/pages/common/selectDialog.dart b/lib/pages/common/selectDialog.dart index 92c0d83..fedbefd 100644 --- a/lib/pages/common/selectDialog.dart +++ b/lib/pages/common/selectDialog.dart @@ -258,6 +258,7 @@ Future showDateSelectionDialog(BuildContext context, String title = "选择生日"}) { ThemeController themeController = Get.find(); final bool isEn = Get.locale?.languageCode.startsWith('en') ?? false; + final bool isCn = Get.locale?.languageCode.startsWith('zh') ?? false; Color checkColor = stringToColor("#D3B684"); final List years = List.generate(100, (i) => DateTime.now().year - i) @@ -380,7 +381,7 @@ Future showDateSelectionDialog(BuildContext context, child: Padding( padding: EdgeInsets.symmetric(horizontal: 95.rpx), child: Row( - children: isEn + children: !isCn ? [ Expanded( child: getOnePickers( diff --git a/lib/pages/device/component/MessageTypeComponent.dart b/lib/pages/device/component/MessageTypeComponent.dart index 2361c2a..556ef84 100644 --- a/lib/pages/device/component/MessageTypeComponent.dart +++ b/lib/pages/device/component/MessageTypeComponent.dart @@ -1,10 +1,12 @@ +import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'dart:convert'; class MessageTypeComponent extends StatelessWidget { final Map config; - const MessageTypeComponent({Key? key, required this.config}) : super(key: key); + const MessageTypeComponent({Key? key, required this.config}) + : super(key: key); @override Widget build(BuildContext context) { @@ -30,10 +32,10 @@ class MessageTypeComponent extends StatelessWidget { children: [ // 标题栏 _buildHeader(name, type), - + // 分隔线 const Divider(height: 1, color: Color(0xFFEEEEEE)), - + // 数据列表 _buildDataList(dataList), ], @@ -57,7 +59,8 @@ class MessageTypeComponent extends StatelessWidget { ), ), Container( - padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 4.0), + padding: + const EdgeInsets.symmetric(horizontal: 12.0, vertical: 4.0), decoration: BoxDecoration( color: _getTypeColor(type), borderRadius: BorderRadius.circular(20.0), @@ -79,10 +82,10 @@ class MessageTypeComponent extends StatelessWidget { // 构建数据列表 Widget _buildDataList(List dataList) { if (dataList.isEmpty) { - return const Padding( + return Padding( padding: EdgeInsets.all(16.0), child: Text( - '暂无数据', + '暂无数据'.tr, style: TextStyle(color: Colors.grey), ), ); @@ -110,7 +113,7 @@ class MessageTypeComponent extends StatelessWidget { Widget _buildDataItem(Map item) { final String itemName = item['name']?.toString() ?? '未知'; final int? id = item['id']; - + return Container( padding: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 12.0), child: Row( @@ -136,7 +139,7 @@ class MessageTypeComponent extends StatelessWidget { ), ), ), - + // 数据内容 Expanded( child: Column( @@ -150,9 +153,9 @@ class MessageTypeComponent extends StatelessWidget { color: Color(0xFF333333), ), ), - + const SizedBox(height: 4.0), - + // 动态显示其他字段 ..._buildExtraFields(item), ], @@ -166,13 +169,13 @@ class MessageTypeComponent extends StatelessWidget { // 构建额外字段显示 List _buildExtraFields(Map item) { final List fields = []; - + // 遍历所有字段,排除已经显示的 id 和 name item.forEach((key, value) { if (key != 'id' && key != 'name' && value != null) { final String displayKey = _getDisplayKey(key); final String displayValue = _formatValue(value); - + fields.add( Padding( padding: const EdgeInsets.only(top: 2.0), @@ -201,7 +204,7 @@ class MessageTypeComponent extends StatelessWidget { ); } }); - + return fields; } @@ -214,7 +217,7 @@ class MessageTypeComponent extends StatelessWidget { 'duration': '持续时间(秒)', 'time': '时间', }; - + return keyMap[key] ?? key; } @@ -253,4 +256,4 @@ class MessageTypeComponent extends StatelessWidget { return '未知'; } } -} \ No newline at end of file +} diff --git a/lib/pages/mh_page/apply_repair_page.dart b/lib/pages/mh_page/apply_repair_page.dart index f379cdc..9c8cd61 100644 --- a/lib/pages/mh_page/apply_repair_page.dart +++ b/lib/pages/mh_page/apply_repair_page.dart @@ -204,6 +204,10 @@ class ApplyRepairPage extends GetView { height: 1, color: Colors .white), + maxLines: 2, + overflow: + TextOverflow + .ellipsis, ), ), ), @@ -612,6 +616,10 @@ class ApplyRepairPage extends GetView { height: 1, color: Colors .white), + maxLines: 2, + overflow: + TextOverflow + .ellipsis, ), ), ), @@ -1038,33 +1046,78 @@ class ApplyRepairPage extends GetView { ), ), ), + // Flexible( + // child: Container( + // width: 300.rpx, + // height: 62.rpx, + // decoration: BoxDecoration( + // borderRadius: + // BorderRadius + // .circular(50), + // border: Border.all( + // color: const Color( + // 0xFF9EA4B7), + // ), + // ), + // child: Align( + // alignment: + // const AlignmentDirectional( + // 0, 0), + // child: Text( + // '上传设备故障照片'.tr, + // style: TextStyle( + // fontFamily: + // 'Readex Pro', + // color: const Color( + // 0xFF9EA4B7), + // fontSize: AppFontsize + // .normal_text_size, + // letterSpacing: 0, + // ), + // maxLines: 1, + // overflow: TextOverflow + // .ellipsis, + // ), + // ), + // ), + // ), Flexible( - child: Container( - width: 300.rpx, - height: 62.rpx, - decoration: BoxDecoration( - borderRadius: - BorderRadius - .circular(50), - border: Border.all( - color: const Color( - 0xFF9EA4B7), - ), - ), - child: Align( - alignment: - const AlignmentDirectional( - 0, 0), - child: Text( - '上传设备故障照片'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', + child: IntrinsicWidth( + child: Container( + height: 62.rpx, + decoration: + BoxDecoration( + borderRadius: + BorderRadius + .circular(50), + border: Border.all( color: const Color( 0xFF9EA4B7), - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, + ), + ), + padding: EdgeInsets + .symmetric( + horizontal: + 30.rpx), + child: Align( + alignment: + const AlignmentDirectional( + 0, 0), + child: Text( + '上传设备故障照片'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: const Color( + 0xFF9EA4B7), + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + maxLines: 1, + overflow: + TextOverflow + .ellipsis, ), ), ), @@ -1319,7 +1372,8 @@ class ApplyRepairPage extends GetView { fontSize: AppFontsize .normal_text_size, letterSpacing: 0, - color: themeController.currentColor.sc4), + color: themeController + .currentColor.sc4), enabledBorder: UnderlineInputBorder( borderSide: const BorderSide( @@ -1474,6 +1528,10 @@ class ApplyRepairPage extends GetView { 0, color: Colors .white), + maxLines: 1, + overflow: + TextOverflow + .ellipsis, ), ], ), @@ -1525,7 +1583,9 @@ class ApplyRepairPage extends GetView { 'Readex Pro', letterSpacing: 0, - color: themeController.currentColor.sc4, + color: themeController + .currentColor + .sc4, ), enabledBorder: UnderlineInputBorder( @@ -1622,25 +1682,29 @@ class ApplyRepairPage extends GetView { 0.038, constraints: BoxConstraints( - minWidth: 60.rpx, + minWidth: 60, ), - child: Row( - mainAxisSize: - MainAxisSize.max, - children: [ - Text( - '手机号码'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - fontSize: - 26.rpx, - letterSpacing: - 0, - color: Colors - .white), - ), - ], + child: Align( + alignment: + const AlignmentDirectional( + -1, 0), + child: Text( + '手机号码'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + fontSize: + 26.rpx, + letterSpacing: + 0, + height: 1, + color: Colors + .white), + maxLines: 1, + overflow: + TextOverflow + .ellipsis, + ), ), ), Expanded( @@ -1688,7 +1752,9 @@ class ApplyRepairPage extends GetView { 'Readex Pro', letterSpacing: 0, - color: themeController.currentColor.sc4, + color: themeController + .currentColor + .sc4, ), enabledBorder: UnderlineInputBorder( diff --git a/lib/pages/mh_page/book_info_page.dart b/lib/pages/mh_page/book_info_page.dart index 1ce3717..686aa94 100644 --- a/lib/pages/mh_page/book_info_page.dart +++ b/lib/pages/mh_page/book_info_page.dart @@ -248,6 +248,9 @@ class BookInfoPage extends GetView { ? stringToColor( '#D0D0D0') : Colors.white), + maxLines: 1, + overflow: + TextOverflow.ellipsis, ), ), Icon( diff --git a/lib/pages/mh_page/device/component/DeviceComponentWidget.dart b/lib/pages/mh_page/device/component/DeviceComponentWidget.dart index e4815a4..9a710bf 100644 --- a/lib/pages/mh_page/device/component/DeviceComponentWidget.dart +++ b/lib/pages/mh_page/device/component/DeviceComponentWidget.dart @@ -166,7 +166,7 @@ class _DeviceComponentWidgetState extends State { ), ), Text( - "${device['bind'] == true ? "已被绑定" : "可绑定"}", + "${device['bind'] == true ? "已被绑定".tr : "可绑定".tr}", style: TextStyle( fontSize: 26.rpx, color: device['bind'] == true diff --git a/lib/pages/mh_page/device/controller/mht_bluetooth_controller.dart b/lib/pages/mh_page/device/controller/mht_bluetooth_controller.dart index c6becb9..59bdd21 100644 --- a/lib/pages/mh_page/device/controller/mht_bluetooth_controller.dart +++ b/lib/pages/mh_page/device/controller/mht_bluetooth_controller.dart @@ -82,7 +82,6 @@ class MHTBlueToothController extends GetControllerEx { RxBool allSelect = false.obs; //升级是否全选 RxBool autoUpgrade = false.obs; //是否自动升级 - void startStatusPolling() { updateDeviceStatus().then((res) { if (res.code == HttpStatusCodes.ok) { @@ -419,6 +418,28 @@ class MHTBlueToothController extends GetControllerEx { return result; // 在 requestWithLog 完成之后返回 result } + sendCommand(Map commandData) async { + //todo 下发wifi指令 + if (commandData == null || commandData.isEmpty) { + throw "指令数据不能为空"; + } + //todo 填充蓝牙指令 + String serviceAddress = ServiceConstant.service_address; + String serviceName = ServiceConstant.server_service; + String serviceApi = ServiceConstant.sendWifiCommand; + String queryUrl = "${serviceAddress}${serviceName}${serviceApi}"; + await requestWithLog( + logTitle: "下发wifi控制指令", + method: MyHttpMethod.post, + queryUrl: queryUrl, + onSuccess: (res) { + }, + onFailure: (res) { + throw "下发wifi控制指令失败: ${res.msg}"; + }, + ); + } + //todo 解绑的时候删除自己所拥有的所有设备的睡眠习惯 } diff --git a/lib/pages/mh_page/device/mht_bind_device_success.dart b/lib/pages/mh_page/device/mht_bind_device_success.dart index ff4caf1..1ec94fb 100644 --- a/lib/pages/mh_page/device/mht_bind_device_success.dart +++ b/lib/pages/mh_page/device/mht_bind_device_success.dart @@ -16,6 +16,7 @@ import 'package:vbvs_app/controller/main_bottom/global_controller.dart'; import 'package:vbvs_app/controller/person/person_controller.dart'; import 'package:vbvs_app/controller/theme_controller/ThemeController.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; +import 'package:vbvs_app/pages/mh_page/device/controller/mht_bluetooth_controller.dart'; import 'package:vbvs_app/pages/mh_page/device/model/BlueToothDataModel.dart'; import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart'; @@ -245,9 +246,9 @@ class _MHTBindDeviceSuccessState extends State { Map editeData; BlueToothDataModel data = blueteethBindController.shareDevice; + editeData = {"mac".tr: data.mac}; Get.toNamed("/deviceSharePage", arguments: editeData); - }, colors: AppConstants().mhtButtongradientColors, gradientDirection: GradientDirection.vertical, @@ -367,7 +368,6 @@ class _MHTBindDeviceSuccessState extends State { ), ), ), - ), ], ), diff --git a/lib/pages/mh_page/device/mht_blueteeth_device_page.dart b/lib/pages/mh_page/device/mht_blueteeth_device_page.dart index 4acf56b..d2ef8b6 100644 --- a/lib/pages/mh_page/device/mht_blueteeth_device_page.dart +++ b/lib/pages/mh_page/device/mht_blueteeth_device_page.dart @@ -502,13 +502,19 @@ class _MHTBlueteethDevicePageState extends State { child: Row( mainAxisSize: MainAxisSize.max, children: [ - Text( - '最小信号强度'.tr, - style: TextStyle( - fontFamily: 'Inter', - color: stringToColor("#FFFFFF"), - fontSize: 26.rpx, - letterSpacing: 0.0, + Container( + constraints: BoxConstraints( + maxWidth: boxConstraints.maxWidth * 0.3), + child: Text( + '最小信号强度'.tr, + style: TextStyle( + fontFamily: 'Inter', + color: stringToColor("#FFFFFF"), + fontSize: 26.rpx, + letterSpacing: 0.0, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), Expanded( diff --git a/lib/pages/mh_page/device/mht_people_info.dart b/lib/pages/mh_page/device/mht_people_info.dart index 8e9af76..17a1efe 100644 --- a/lib/pages/mh_page/device/mht_people_info.dart +++ b/lib/pages/mh_page/device/mht_people_info.dart @@ -895,37 +895,56 @@ class _MHTPeopleInfoPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - '请选择城市'.tr, - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFF9EA4B7), - fontSize: 30.rpx, - letterSpacing: 0, + Expanded( + flex: 1, // 左侧占1份权重(约33%) + child: Text( + '请选择城市'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Color(0xFF9EA4B7), + fontSize: 30.rpx, + letterSpacing: 0, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), - Row( - children: [ - Text( - cityModels[index].id != null - ? MyUtils - .getDetailedCityDisplayText( - cityModels[index]) - : "请选择城市".tr, - style: TextStyle( - color: - cityModels[index].id != null - ? Colors.white - : themeController - .currentColor.sc4, - fontSize: 30.rpx, + Expanded( + flex: 2, // 右侧占2份权重(约67%) + child: Row( + mainAxisAlignment: MainAxisAlignment + .end, // 右侧内容右对齐 + children: [ + Flexible( + child: Text( + cityModels[index].id != null + ? MyUtils + .getDetailedCityDisplayText( + cityModels[index]) + : "请选择城市".tr, + style: TextStyle( + color: + cityModels[index].id != + null + ? Colors.white + : themeController + .currentColor + .sc4, + fontSize: 30.rpx, + ), + maxLines: 1, + overflow: + TextOverflow.ellipsis, + textAlign: + TextAlign.right, // 文本右对齐 + ), ), - ), - SizedBox(width: 16.rpx), - Icon(Icons.expand_more, - color: Colors.white, - size: 48.rpx), - ], + SizedBox(width: 16.rpx), + Icon(Icons.expand_more, + color: Colors.white, + size: 48.rpx), + ], + ), ), ], ), @@ -973,52 +992,69 @@ class _MHTPeopleInfoPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - '请选择时区'.tr, - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFF9EA4B7), - fontSize: 30.rpx, - letterSpacing: 0, + Expanded( + flex: 1, // 左侧占1份权重(约33%) + child: Text( + '请选择时区'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Color(0xFF9EA4B7), + fontSize: 30.rpx, + letterSpacing: 0, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), - Obx(() { - PeopleInfoController - personController = Get.find(); - var aa = - personController.timeZone.value; - return Row( - children: [ - Text( - peopleList[index]['UTC'] == - null || - peopleList[index] - ['UTC'] == - "" - ? "请选择时区".tr - : peopleList[index]['UTC'], - style: TextStyle( - color: peopleList[index] - ['UTC'] != - null - ? Colors - .white // 有时区时使用白色,保持和参考代码一致 - : themeController - .currentColor.sc4, - fontSize: 30 - .rpx, // 使用固定的30.rpx,而不是AppConstants().title_text_fontSize - ), - ), - SizedBox(width: 16.rpx), - Icon( - Icons.expand_more, - color: Colors - .white, // 保持白色,和参考代码一致 - size: 48.rpx, - ), - ], - ); - }) + Expanded( + flex: 2, // 右侧占2份权重(约67%) + child: Obx(() { + PeopleInfoController + personController = Get.find(); + var aa = personController + .timeZone.value; + return Row( + mainAxisAlignment: + MainAxisAlignment + .end, // 右侧内容右对齐 + children: [ + Flexible( + child: Text( + peopleList[index] + ['UTC'] == + null || + peopleList[index] + ['UTC'] == + "" + ? "请选择时区".tr + : peopleList[index] + ['UTC'], + style: TextStyle( + color: peopleList[index] + ['UTC'] != + null + ? Colors.white + : themeController + .currentColor + .sc4, + fontSize: 30.rpx, + ), + maxLines: 1, + overflow: + TextOverflow.ellipsis, + textAlign: TextAlign + .right, // 文本右对齐 + ), + ), + SizedBox(width: 16.rpx), + Icon( + Icons.expand_more, + color: Colors.white, + size: 48.rpx, + ), + ], + ); + })), ], ), ), @@ -1063,38 +1099,92 @@ class _MHTPeopleInfoPageState extends State { ); }); }, + // child: Row( + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // Text( + // '慢病管理'.tr, + // style: TextStyle( + // fontFamily: 'Readex Pro', + // color: Color(0xFF9EA4B7), + // fontSize: 30.rpx, + // letterSpacing: 0, + // ), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Row( + // children: [ + // Text( + // getSelectedDiseaseNames( + // diseaseIdsList[index]), + // style: TextStyle( + // color: diseaseIdsList[index] + // .isNotEmpty + // ? Colors.white + // : themeController + // .currentColor.sc4, + // fontSize: 30.rpx, + // ), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // SizedBox(width: 16.rpx), + // Icon(Icons.expand_more, + // color: Colors.white, + // size: 48.rpx), + // ], + // ), + // ], + // ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - '慢病管理'.tr, - style: TextStyle( - fontFamily: 'Readex Pro', - color: Color(0xFF9EA4B7), - fontSize: 30.rpx, - letterSpacing: 0, + Expanded( + flex: 1, // 设置左侧最大宽度权重 + child: Text( + '慢病管理'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Color(0xFF9EA4B7), + fontSize: 30.rpx, + letterSpacing: 0, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), - Row( - children: [ - Text( - getSelectedDiseaseNames( - diseaseIdsList[index]), - style: TextStyle( - color: diseaseIdsList[index] - .isNotEmpty - ? Colors.white - : themeController - .currentColor.sc4, - fontSize: 30.rpx, + Expanded( + flex: 2, // 右侧内容占更多空间 + child: Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: [ + Flexible( + child: Text( + getSelectedDiseaseNames( + diseaseIdsList[index]), + style: TextStyle( + color: diseaseIdsList[index] + .isNotEmpty + ? Colors.white + : themeController + .currentColor.sc4, + fontSize: 30.rpx, + ), + maxLines: 1, + overflow: + TextOverflow.ellipsis, + ), ), - ), - SizedBox(width: 16.rpx), - Icon(Icons.expand_more, - color: Colors.white, - size: 48.rpx), - ], + SizedBox(width: 16.rpx), + Icon(Icons.expand_more, + color: Colors.white, + size: 48.rpx), + ], + ), ), ], ), diff --git a/lib/pages/mh_page/device/mht_wifi_page.dart b/lib/pages/mh_page/device/mht_wifi_page.dart index c4f3ed0..9e4306a 100644 --- a/lib/pages/mh_page/device/mht_wifi_page.dart +++ b/lib/pages/mh_page/device/mht_wifi_page.dart @@ -57,6 +57,7 @@ class _MHTWifiPageState extends State { WidgetsBinding.instance.addPostFrameCallback((_) async { // _initController(); + blueteethBindController.shareDevice = widget.deviceInfo; await dealWifi(widget.deviceInfo.macA); print("object"); }); diff --git a/lib/pages/mh_page/device_people_info.dart b/lib/pages/mh_page/device_people_info.dart index 83258dd..d4bdf7d 100644 --- a/lib/pages/mh_page/device_people_info.dart +++ b/lib/pages/mh_page/device_people_info.dart @@ -165,7 +165,7 @@ class DevicePeopleInfo extends GetView { getInfoRow( context, "设备状态".tr, - "${data["status"]?["status"] == 1 ? "已绑定" : data["status"]?["status"] == 0 ? "已绑定" : "-"}", + "${data["status"]?["status"] == 1 ? "已绑定".tr : data["status"]?["status"] == 0 ? "已绑定".tr : "-"}", ), getInfoRow( context, "MAC", "${data["mac"] ?? "-"}"), @@ -211,7 +211,7 @@ class DevicePeopleInfo extends GetView { getInfoRow(context, "姓名".tr, "${person["name"] ?? "-"}"), getInfoRow(context, "性别".tr, - "${person["gender"] == null ? "-" : (person["gender"] == 1 ? "男" : "女")}"), + "${person["gender"] == null ? "-" : (person["gender"] == 1 ? "男".tr : "女".tr)}"), getInfoRow(context, "身高".tr, "${person["height"] == null ? "-" : "${person["height"]}cm"}"), getInfoRow(context, "体重".tr, diff --git a/lib/pages/mh_page/device_share_page.dart b/lib/pages/mh_page/device_share_page.dart index 3ae4bba..68f4124 100644 --- a/lib/pages/mh_page/device_share_page.dart +++ b/lib/pages/mh_page/device_share_page.dart @@ -161,8 +161,8 @@ class ShareDeviceWidget extends GetView { hintText: '请输入对方手机号/邮箱号'.tr, hintStyle: TextStyle( fontFamily: 'Readex Pro', - color: themeController - .currentColor.sc4, + color: + themeController.currentColor.sc4, fontSize: 36.rpx, ), enabledBorder: @@ -247,13 +247,17 @@ class ShareDeviceWidget extends GetView { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - '允许对方控制和查看该设备'.tr, - style: TextStyle( - fontFamily: 'Readex Pro', - color: Colors.white, - fontSize: 26.rpx, - letterSpacing: 0.0, + Expanded( + child: Text( + '允许对方控制和查看该设备'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Colors.white, + fontSize: 26.rpx, + letterSpacing: 0.0, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), Obx(() { @@ -313,13 +317,17 @@ class ShareDeviceWidget extends GetView { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - '仅允许对方查看该设备'.tr, - style: TextStyle( - fontFamily: 'Readex Pro', - color: Colors.white, - fontSize: 26.rpx, - letterSpacing: 0.0, + Expanded( + child: Text( + '仅允许对方查看该设备'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Colors.white, + fontSize: 26.rpx, + letterSpacing: 0.0, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), // ✅ 只包住响应式控件部分 diff --git a/lib/pages/mh_page/homepage/controller/mht_home_controller.dart b/lib/pages/mh_page/homepage/controller/mht_home_controller.dart index 2a03f87..c1f3036 100644 --- a/lib/pages/mh_page/homepage/controller/mht_home_controller.dart +++ b/lib/pages/mh_page/homepage/controller/mht_home_controller.dart @@ -271,96 +271,6 @@ class MHTHomeController extends GetControllerEx { return ApiResponse(code: -1, msg: "未知错误".tr); // Default return statement } - // Future getSleepReport() async { - // try { - // sleepReportData.value = {}; - // ApiResponse>> apiResponse = ApiResponse( - // code: -1, - // msg: "请求失败".tr, - // ); - - // if (deviceList.value.isEmpty) { - // return ApiResponse( - // code: HttpStatusCodes.ok, - // msg: "请求成功".tr, - // ); - // } - - // String serviceAddress = ServiceConstant.service_address; - // String serviceName = ServiceConstant.server_service; - // String serviceApi = ServiceConstant.sleep_report; - - // // for (var device in deviceList.value) { - // // String mac = device['mac'] ?? ""; - // // if (mac.isEmpty) continue; - - // // sleepReportData[mac] = []; // 初始化当前设备的数据列表 - - // // String queryUrl = - // // "$serviceAddress$serviceName$serviceApi?mac=$mac&time=${DateTime.now().millisecondsSinceEpoch}"; - - // // try { - // // String? language = ""; - // // if (languageController.selectLanguage != null) { - // // language = languageController.selectLanguage.value!.language_code; - // // } - // // if (language != null && language.isNotEmpty) { - // // if (queryUrl.contains("?")) { - // // queryUrl += "&lang=$language"; - // // } else { - // // queryUrl += "?lang=$language"; - // // } - // // } - // // var response = await EasyDartModule.dio.get(queryUrl); - // // if (response != null) { - // // var responseData = response.data is String - // // ? jsonDecode(response.data) - // // : response.data; - - // // ApiResponse res = - // // ApiResponse.fromJson(responseData, (object) => object); - - // // if (res.code == HttpStatusCodes.ok && res.data != null) { - // // // 确保数据是一个列表 - // // if (res.data is List) { - // // sleepReportData[mac] = List.from(res.data); - // // } else { - // // sleepReportData[mac] = [res.data]; - // // } - // // } - // // } - // // } catch (e) { - // // EasyDartModule.logger.warning("请求设备 $mac 的睡眠数据失败: $e"); - // // } - // // } - // if (sleepReportData.value.isNotEmpty) { - // // 遍历 Map 中的每一个键值对 - // sleepReportData.value.forEach((key, report) { - // // 确保 report 列表不为空 - // if (report.isNotEmpty) { - // // 获取该列表的最后一个元素 - // var lastElement = report.last; - - // // 给最后一个元素添加 selected 属性 - // lastElement['selected'] = true; // 假设每个元素是一个 Map 类型 - // } - // }); - // } - - // updateAll(); - - // return ApiResponse( - // code: HttpStatusCodes.ok, - // msg: "请求成功".tr, - // data: sleepReportData, - // ); - // } catch (e) { - // EasyDartModule.logger.info("设备请求列表异常: $e"); - // DailyLogUtils.writeLog("设备请求列表异常: $e"); - // return ApiResponse(code: -1, msg: "未知错误".tr, data: {}); - // } - // } - updateDeviceShow(device) async { try { ApiResponse apiResponse = ApiResponse(code: -1, msg: "操作失败".tr); diff --git a/lib/pages/mh_page/homepage/new_Home_page.dart b/lib/pages/mh_page/homepage/new_Home_page.dart index a60290f..1167387 100644 --- a/lib/pages/mh_page/homepage/new_Home_page.dart +++ b/lib/pages/mh_page/homepage/new_Home_page.dart @@ -15,6 +15,7 @@ import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart'; import 'package:vbvs_app/controller/user_info_controller.dart'; import 'package:vbvs_app/controller/weather/weather_controller.dart'; import 'package:vbvs_app/enum/APPPackageType.dart'; +import 'package:vbvs_app/network/NetworkStatusController.dart'; import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart'; import 'package:vbvs_app/pages/mh_page/FloatingSvgIcon.dart'; import 'package:vbvs_app/pages/mh_page/component/mht_bind_dialog.dart'; @@ -45,6 +46,7 @@ class _NewHomePageState extends State { @override void initState() { super.initState(); + NetworkStatusController networkStatusController = Get.find(); if (userInfoController.model.login == 1) { //查询人员信息列表 deviceController.getPersonList(); @@ -567,29 +569,11 @@ class _NewHomePageState extends State { ), ), ), - InkWell( onTap: () { if (formFieldController .value != - null) { - // Get.toNamed( - // "/newSleepReportPage", - // arguments: { - // 'mac': - // formFieldController - // .value!, - // 'type': 1, - // "person": - // personInfo.value, - // 'backgroundImg': - // 'assets/images/new_background.png', - // 'date': DateTime.now() - // .millisecondsSinceEpoch, - // 'person_show': false, - // 'reportPadding': false, - // }, - // ); + null) { sleepReportController .initParams( macValue: @@ -758,6 +742,10 @@ class _NewHomePageState extends State { color: stringToColor( "#FFFFFF"), ), + maxLines: 1, + overflow: + TextOverflow + .ellipsis, ), SizedBox( height: diff --git a/lib/pages/mh_page/people_info.dart b/lib/pages/mh_page/people_info.dart index 6382e0c..d9e635f 100644 --- a/lib/pages/mh_page/people_info.dart +++ b/lib/pages/mh_page/people_info.dart @@ -1158,7 +1158,7 @@ class PeopleInfoPage extends GetView { newDiseaseIds; controller.updateAll(); }, - title: "选择慢病".tr, + title: "请选择慢病".tr, colors: DiseaseSelectionColors( pickerBackgroundColor: diff --git a/lib/pages/mh_page/test/WebviewTestModel.dart b/lib/pages/mh_page/test/WebviewTestModel.dart index 5441390..a02352b 100644 --- a/lib/pages/mh_page/test/WebviewTestModel.dart +++ b/lib/pages/mh_page/test/WebviewTestModel.dart @@ -69,7 +69,7 @@ class WebviewTestController extends GetControllerEx { bridge: bridge, onConnect: (args1, args2) { final devices = args1.devices as Map; - final mac = args2 as String; + final mac = args2 as String; if (devices.containsKey(mac)) { final device = devices[mac]; ef.log('Minibleapp connected(Android): $mac -> $device'); @@ -340,6 +340,17 @@ class WebviewTestController extends GetControllerEx { } return true; }); + bridge.sdk.sendCommand((args) async { + ef.log('wifi控制指令: $args[0]'); + try { + MHTBlueToothController blueToothController = Get.find(); + // await blueToothController.saveHabitData(args[0]); + await blueToothController.sendCommand(args[0]); + } catch (e) { + ef.log("[wifi控制下发指令失败]:$e"); + } + return true; + }); }); } catch (e, s) { ef.log('$e,$s'); diff --git a/lib/pages/mh_page/user/page/mht_login_page.dart b/lib/pages/mh_page/user/page/mht_login_page.dart index b786def..66b27ab 100644 --- a/lib/pages/mh_page/user/page/mht_login_page.dart +++ b/lib/pages/mh_page/user/page/mht_login_page.dart @@ -1022,6 +1022,10 @@ class MHTLoginPage extends GetView { letterSpacing: 0, ), + maxLines: 1, + overflow: + TextOverflow + .ellipsis, ), ), ), @@ -1134,6 +1138,10 @@ class MHTLoginPage extends GetView { letterSpacing: 0, ), + maxLines: 1, + overflow: + TextOverflow + .ellipsis, ), ), ), @@ -1992,7 +2000,10 @@ class MHTLoginPage extends GetView { mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment + .start, // 改为顶部对齐 children: [ + // 左边的选择框 - 保持不变 Align( alignment: AlignmentDirectional(0, 0), @@ -2008,190 +2019,138 @@ class MHTLoginPage extends GetView { AlignmentDirectional( 0, 0), child: Theme( - data: ThemeData( - checkboxTheme: - CheckboxThemeData( - visualDensity: - VisualDensity - .compact, - materialTapTargetSize: - MaterialTapTargetSize - .shrinkWrap, - shape: - RoundedRectangleBorder( - borderRadius: - BorderRadius - .circular( - 64), - ), + data: ThemeData( + checkboxTheme: + CheckboxThemeData( + visualDensity: + VisualDensity + .compact, + materialTapTargetSize: + MaterialTapTargetSize + .shrinkWrap, + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular( + 64), ), - unselectedWidgetColor: - Color(0xFFD3D3D3), ), - child: Obx( - () => Checkbox( - value: registerController + unselectedWidgetColor: + Color(0xFFD3D3D3), + ), + child: Obx( + () => Checkbox( + value: registerController + .model + .register_agree ?? + false, + onChanged: + (newValue) async { + registerController .model - .register_agree ?? - false, - onChanged: - (newValue) async { - registerController - .model - .register_agree = - newValue; - - controller - .updateAll(); - registerController - .updateAll(); - // 获取设备信息,需要用户点击确认隐私协议与用户协议选择框时才能获取 - // if (newValue == - // true) { - // Deviceconfig - // .initPlatformState(); - // } - }, - side: BorderSide( - width: 1.5, - color: - Colors.white, - ), - activeColor: - stringToColor( - "#84F5FF"), - checkColor: - stringToColor( - "#011D33"), + .register_agree = + newValue; + controller + .updateAll(); + registerController + .updateAll(); + }, + side: BorderSide( + width: 1.5, + color: Colors.white, ), - )), + activeColor: + stringToColor( + "#84F5FF"), + checkColor: + stringToColor( + "#011D33"), + ), + ), + ), ), ), ), ), - Flexible( - child: Padding( - padding: EdgeInsetsDirectional - .fromSTEB(0, 0, 0, 0), - child: Container( - width: - MediaQuery.sizeOf(context) - .width * - 0.622, - height: - MediaQuery.sizeOf(context) - .height * - 1, - constraints: BoxConstraints( - minWidth: 466, - minHeight: 30, - ), - decoration: BoxDecoration(), - child: Container( - width: 100, - height: 100, - decoration: BoxDecoration(), - child: Row( - mainAxisSize: - MainAxisSize.max, - children: [ - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Text( - '我已阅读并同意'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: - Colors.white, - fontSize: 23.rpx, - letterSpacing: 0, - ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: InkWell( - onTap: () { - Get.toNamed( - "/userPolicyPageNew", - arguments: - getPrivacy( - 2)); - }, - child: Text( - '《用户协议》'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: - stringToColor( - "FF9F66"), - fontSize: - 23.rpx, - letterSpacing: - 0, - ), - ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Text( - '与'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: - Colors.white, - fontSize: 23.rpx, - letterSpacing: 0, - ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: InkWell( - onTap: () { - Get.toNamed( - "/privacyPolicyPageNew", - arguments: - getPrivacy( - 1)); - }, - child: Text( - '《隐私协议》'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: - stringToColor( - "FF9F66"), - fontSize: - 23.rpx, - letterSpacing: - 0, - ), - ), - ), - ), - ], + + // 右边的文字部分 - 修改这里 + SizedBox(width: 8), // 添加一些间距 + Expanded( + // 使用 Expanded 而不是 Flexible + child: Container( + decoration: BoxDecoration(), + child: Wrap( + // 使用 Wrap 替代 Row,实现自动换行 + spacing: 0, // 文字之间的水平间距 + runSpacing: 0, // 行之间的垂直间距 + children: [ + Text( + '我已阅读并同意'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: Colors.white, + fontSize: 23.rpx, + letterSpacing: 0, + ), ), - ), + InkWell( + onTap: () { + Get.toNamed( + "/userPolicyPageNew", + arguments: + getPrivacy(2)); + }, + child: Text( + '《用户协议》'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: stringToColor( + "FF9F66"), + fontSize: 23.rpx, + letterSpacing: 0, + ), + ), + ), + Text( + '与'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: Colors.white, + fontSize: 23.rpx, + letterSpacing: 0, + ), + ), + InkWell( + onTap: () { + Get.toNamed( + "/privacyPolicyPageNew", + arguments: + getPrivacy(1)); + }, + child: Text( + '《隐私协议》'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: stringToColor( + "FF9F66"), + fontSize: 23.rpx, + letterSpacing: 0, + ), + ), + ), + ], ), ), ), ], ), ), + ), ), Obx(() { @@ -2229,7 +2188,7 @@ class MHTLoginPage extends GetView { .fromSTEB( 0, 0, 0, 0), child: Container( - width: 36, + width: 44, height: 36, decoration: BoxDecoration(), @@ -2247,44 +2206,26 @@ class MHTLoginPage extends GetView { context) .width * 0.622, - height: MediaQuery.sizeOf( - context) - .height * - 1, - // constraints: - // BoxConstraints( - // minWidth: 466, - // minHeight: 30, - // ), decoration: BoxDecoration(), child: Container( - // width: 100, - // height: 100, decoration: BoxDecoration(), - child: Row( - mainAxisSize: - MainAxisSize.max, + child: Wrap( + // 将 Row 改为 Wrap,实现自动换行 children: [ - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Text( - '注:首次登录会自动创建账号' - .tr, - style: - TextStyle( - fontFamily: - 'Readex Pro', - color: stringToColor( - "#FFFFFF"), - fontSize: - 23.rpx, - letterSpacing: - 0, - ), + Text( + '注:首次登录会自动创建账号' + .tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: stringToColor( + "#FFFFFF"), + fontSize: + 23.rpx, + letterSpacing: + 0, ), ), ], @@ -2371,17 +2312,17 @@ class MHTLoginPage extends GetView { child: Text.rich( TextSpan( children: [ - TextSpan( - text: "还没有账号?".tr, - style: TextStyle( - color: Colors - .white, // 设置"还没有账号?"为白色 - fontFamily: - 'Readex Pro', - fontSize: AppFontsize - .small_text_size, - ), - ), + // TextSpan( + // text: "还没有账号?".tr, + // style: TextStyle( + // color: Colors + // .white, // 设置"还没有账号?"为白色 + // fontFamily: + // 'Readex Pro', + // fontSize: AppFontsize + // .small_text_size, + // ), + // ), TextSpan( text: '前往注册'.tr, style: TextStyle( diff --git a/lib/pages/mh_page/user/page/register_page.dart b/lib/pages/mh_page/user/page/register_page.dart index 67d2ccf..9659731 100644 --- a/lib/pages/mh_page/user/page/register_page.dart +++ b/lib/pages/mh_page/user/page/register_page.dart @@ -826,11 +826,206 @@ class RegisterPage extends GetView { minHeight: 30, ), decoration: BoxDecoration(), + // child: Row( + // mainAxisSize: MainAxisSize.max, + // mainAxisAlignment: + // MainAxisAlignment.start, + // children: [ + // Align( + // alignment: + // AlignmentDirectional(0, 0), + // child: Padding( + // padding: EdgeInsetsDirectional + // .fromSTEB(0, 3, 0, 0), + // child: Container( + // width: 36, + // height: 36, + // decoration: BoxDecoration(), + // child: Align( + // alignment: + // AlignmentDirectional( + // 0, 0), + // child: Theme( + // data: ThemeData( + // checkboxTheme: + // CheckboxThemeData( + // visualDensity: + // VisualDensity + // .compact, + // materialTapTargetSize: + // MaterialTapTargetSize + // .shrinkWrap, + // shape: + // RoundedRectangleBorder( + // borderRadius: + // BorderRadius + // .circular( + // 64), + // ), + // ), + // unselectedWidgetColor: + // Color(0xFFD3D3D3), + // ), + // child: Obx( + // () => Checkbox( + // value: controller + // .model + // .register_agree ?? + // false, + // onChanged: + // (newValue) async { + // controller.model + // .register_agree = + // newValue; + + // controller + // .updateAll(); + // }, + // side: BorderSide( + // width: 1.5, + // color: Colors.white, + // ), + // activeColor: + // const Color( + // 0xFF84F5FF), + // checkColor: + // Color(0xFF003058), + // visualDensity: + // VisualDensity( + // horizontal: + // -4.0, + // vertical: + // -4.0), + // ), + // )), + // ), + // ), + // ), + // ), + // Flexible( + // child: Padding( + // padding: EdgeInsetsDirectional + // .fromSTEB(0, 0, 0, 0), + // child: Container( + // width: + // MediaQuery.sizeOf(context) + // .width * + // 0.622, + // height: + // MediaQuery.sizeOf(context) + // .height * + // 1, + // constraints: BoxConstraints( + // minWidth: 466, + // minHeight: 30, + // ), + // decoration: BoxDecoration(), + // child: Container( + // width: 100, + // height: 100, + // decoration: BoxDecoration(), + // child: Row( + // mainAxisSize: + // MainAxisSize.max, + // children: [ + // Align( + // alignment: + // AlignmentDirectional( + // 0, 0), + // child: Text( + // '我已阅读并同意'.tr, + // style: TextStyle( + // fontFamily: + // 'Readex Pro', + // color: Colors.white, + // fontSize: 12, + // letterSpacing: 0, + // ), + // ), + // ), + // Align( + // alignment: + // AlignmentDirectional( + // 0, 0), + // child: InkWell( + // onTap: () { + // Get.toNamed( + // "/userPolicyPageNew", + // arguments: + // getPrivacy( + // 2)); + // }, + // child: Text( + // '《用户协议》'.tr, + // style: TextStyle( + // fontFamily: + // 'Readex Pro', + // color: + // stringToColor( + // "FF9F66"), + // fontSize: 12, + // letterSpacing: 0, + // ), + // ), + // ), + // ), + // Align( + // alignment: + // AlignmentDirectional( + // 0, 0), + // child: Text( + // '与'.tr, + // style: TextStyle( + // fontFamily: + // 'Readex Pro', + // color: Colors.white, + // fontSize: 12, + // letterSpacing: 0, + // ), + // ), + // ), + // Align( + // alignment: + // AlignmentDirectional( + // 0, 0), + // child: InkWell( + // onTap: () { + // Get.toNamed( + // "/privacyPolicyPageNew", + // arguments: + // getPrivacy( + // 1)); + // }, + // child: Text( + // '《隐私协议》'.tr, + // style: TextStyle( + // fontFamily: + // 'Readex Pro', + // color: + // stringToColor( + // "FF9F66"), + // fontSize: 12, + // letterSpacing: 0, + // ), + // ), + // ), + // ), + // ], + // ), + // ), + // ), + // ), + // ), + // ], + // ), child: Row( mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment + .start, // 添加这个,让文字与选择框顶部对齐 children: [ + // 左边的选择框 - 保持不变 Align( alignment: AlignmentDirectional(0, 0), @@ -846,173 +1041,133 @@ class RegisterPage extends GetView { AlignmentDirectional( 0, 0), child: Theme( - data: ThemeData( - checkboxTheme: - CheckboxThemeData( - visualDensity: - VisualDensity - .compact, - materialTapTargetSize: - MaterialTapTargetSize - .shrinkWrap, - shape: - RoundedRectangleBorder( - borderRadius: - BorderRadius - .circular( - 64), - ), + data: ThemeData( + checkboxTheme: + CheckboxThemeData( + visualDensity: + VisualDensity + .compact, + materialTapTargetSize: + MaterialTapTargetSize + .shrinkWrap, + shape: + RoundedRectangleBorder( + borderRadius: + BorderRadius + .circular(64), ), - unselectedWidgetColor: - Color(0xFFD3D3D3), ), - child: Obx( - () => Checkbox( - value: controller - .model - .register_agree ?? - false, - onChanged: - (newValue) async { - controller.model - .register_agree = - newValue; - - controller - .updateAll(); - }, - side: BorderSide( - width: 1.5, - color: Colors.white, - ), - activeColor: - const Color( - 0xFF84F5FF), - checkColor: - Color(0xFF003058), - visualDensity: - VisualDensity( - horizontal: - -4.0, - vertical: - -4.0), + unselectedWidgetColor: + Color(0xFFD3D3D3), + ), + child: Obx( + () => Checkbox( + value: controller.model + .register_agree ?? + false, + onChanged: + (newValue) async { + controller.model + .register_agree = + newValue; + controller + .updateAll(); + }, + side: BorderSide( + width: 1.5, + color: Colors.white, ), - )), + activeColor: + const Color( + 0xFF84F5FF), + checkColor: + Color(0xFF003058), + visualDensity: + VisualDensity( + horizontal: -4.0, + vertical: -4.0, + ), + ), + ), + ), ), ), ), ), - Flexible( - child: Padding( - padding: EdgeInsetsDirectional - .fromSTEB(0, 0, 0, 0), - child: Container( - width: - MediaQuery.sizeOf(context) - .width * - 0.622, - height: - MediaQuery.sizeOf(context) - .height * - 1, - constraints: BoxConstraints( - minWidth: 466, - minHeight: 30, - ), - decoration: BoxDecoration(), - child: Container( - width: 100, - height: 100, - decoration: BoxDecoration(), - child: Row( - mainAxisSize: - MainAxisSize.max, - children: [ - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Text( - '我已阅读并同意'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: Colors.white, - fontSize: 12, - letterSpacing: 0, - ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: InkWell( - onTap: () { - Get.toNamed( - "/userPolicyPageNew", - arguments: - getPrivacy( - 2)); - }, - child: Text( - '《用户协议》'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: - stringToColor( - "FF9F66"), - fontSize: 12, - letterSpacing: 0, - ), - ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: Text( - '与'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: Colors.white, - fontSize: 12, - letterSpacing: 0, - ), - ), - ), - Align( - alignment: - AlignmentDirectional( - 0, 0), - child: InkWell( - onTap: () { - Get.toNamed( - "/privacyPolicyPageNew", - arguments: - getPrivacy( - 1)); - }, - child: Text( - '《隐私协议》'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: - stringToColor( - "FF9F66"), - fontSize: 12, - letterSpacing: 0, - ), - ), - ), - ), - ], + SizedBox(width: 8), // 添加间距 + + // 右边的文字部分 - 修改这里 + Expanded( + // 使用 Expanded 替代 Flexible + child: Container( + decoration: BoxDecoration(), + child: Wrap( + // 将 Row 改为 Wrap,实现自动换行 + spacing: 4, // 文字之间的水平间距 + runSpacing: 0, // 行之间的垂直间距 + alignment: + WrapAlignment.start, // 左对齐 + crossAxisAlignment: + WrapCrossAlignment + .center, // 垂直居中 + children: [ + Text( + '我已阅读并同意'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Colors.white, + fontSize: 12, + letterSpacing: 0, + ), ), - ), + InkWell( + onTap: () { + Get.toNamed( + "/userPolicyPageNew", + arguments: + getPrivacy(2)); + }, + child: Text( + '《用户协议》'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: stringToColor( + "FF9F66"), + fontSize: 12, + letterSpacing: 0, + ), + ), + ), + Text( + '与'.tr, + style: TextStyle( + fontFamily: 'Readex Pro', + color: Colors.white, + fontSize: 12, + letterSpacing: 0, + ), + ), + InkWell( + onTap: () { + Get.toNamed( + "/privacyPolicyPageNew", + arguments: + getPrivacy(1)); + }, + child: Text( + '《隐私协议》'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: stringToColor( + "FF9F66"), + fontSize: 12, + letterSpacing: 0, + ), + ), + ), + ], ), ), ), diff --git a/lib/pages/mh_page/user/page/update_password_page.dart b/lib/pages/mh_page/user/page/update_password_page.dart index 447409a..28f644e 100644 --- a/lib/pages/mh_page/user/page/update_password_page.dart +++ b/lib/pages/mh_page/user/page/update_password_page.dart @@ -125,29 +125,37 @@ class UpdatePasswordPage extends GetView { child: Row( mainAxisSize: MainAxisSize.max, children: [ - Container( - constraints: BoxConstraints( - minWidth: 158 - .rpx, // 设置最小宽度为 100 - ), - child: Align( - alignment: - AlignmentDirectional( - -1, 0), - child: Text( - '输入手机号码'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: Colors.white, - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, + Flexible( + flex: 1, + child: Container( + constraints: + BoxConstraints( + minWidth: 158 + .rpx, // 设置最小宽度为 100 + ), + child: Align( + alignment: + AlignmentDirectional( + -1, 0), + child: Text( + '输入手机号码'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: Colors.white, + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + maxLines: 2, + overflow: TextOverflow + .ellipsis, ), ), ), ), Flexible( + flex: 2, child: Container( width: MediaQuery.sizeOf( context) @@ -264,29 +272,37 @@ class UpdatePasswordPage extends GetView { child: Row( mainAxisSize: MainAxisSize.max, children: [ - Container( - constraints: BoxConstraints( - minWidth: 158 - .rpx, // 设置最小宽度为 100 - ), - child: Align( - alignment: - AlignmentDirectional( - -1, 0), - child: Text( - '输入验证码'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: Colors.white, - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, + Flexible( + flex: 1, + child: Container( + constraints: + BoxConstraints( + minWidth: 158 + .rpx, // 设置最小宽度为 100 + ), + child: Align( + alignment: + AlignmentDirectional( + -1, 0), + child: Text( + '输入验证码'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: Colors.white, + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + maxLines: 2, + overflow: TextOverflow + .ellipsis, ), ), ), ), Flexible( + flex: 2, child: Container( width: MediaQuery.sizeOf( context) @@ -483,6 +499,10 @@ class UpdatePasswordPage extends GetView { letterSpacing: 0, ), + maxLines: + 1, + overflow: + TextOverflow.ellipsis, ), ); }), @@ -500,30 +520,37 @@ class UpdatePasswordPage extends GetView { Row( mainAxisSize: MainAxisSize.max, children: [ - Container( - constraints: BoxConstraints( + Flexible( + flex: 1, + child: Container( + constraints: BoxConstraints( minWidth: 158.rpx, - maxWidth: - 158.rpx // 设置最小宽度为 100 - ), - child: Align( - alignment: - AlignmentDirectional( - -1, 0), - child: Text( - '输入新密码'.tr, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: Colors.white, - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, + // maxWidth: 158 + // .rpx // 设置最小宽度为 100 + ), + child: Align( + alignment: + AlignmentDirectional( + -1, 0), + child: Text( + '输入新密码'.tr, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: Colors.white, + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + maxLines: 2, + overflow: TextOverflow + .ellipsis, ), ), ), ), Flexible( + flex: 2, child: Container( width: MediaQuery.sizeOf( context) @@ -665,31 +692,37 @@ class UpdatePasswordPage extends GetView { Row( mainAxisSize: MainAxisSize.max, children: [ - Container( - constraints: BoxConstraints( + Flexible( + flex: 1, + child: Container( + constraints: BoxConstraints( minWidth: 158.rpx, - maxWidth: - 158.rpx // 设置最小宽度为 100 - ), - child: Align( - alignment: - AlignmentDirectional( - -1, 0), - child: Text( - '确认新密码'.tr, - maxLines: 2, - style: TextStyle( - fontFamily: - 'Readex Pro', - color: Colors.white, - fontSize: AppFontsize - .normal_text_size, - letterSpacing: 0, + // maxWidth: 158 + // .rpx // 设置最小宽度为 100 + ), + child: Align( + alignment: + AlignmentDirectional( + -1, 0), + child: Text( + '确认新密码'.tr, + maxLines: 2, + style: TextStyle( + fontFamily: + 'Readex Pro', + color: Colors.white, + fontSize: AppFontsize + .normal_text_size, + letterSpacing: 0, + ), + overflow: TextOverflow + .ellipsis, ), ), ), ), Flexible( + flex: 2, child: Container( width: MediaQuery.sizeOf( context) diff --git a/lib/pages/person/select_disease.dart b/lib/pages/person/select_disease.dart index 148d0e7..c3fb681 100644 --- a/lib/pages/person/select_disease.dart +++ b/lib/pages/person/select_disease.dart @@ -10,7 +10,7 @@ void showDiseaseSelectionDialog( required List selectedIds, required List diseaseList, Function(List)? onDiseasesChanged, - String title = "选择慢病", + String title = "请选择慢病", DiseaseSelectionColors? colors, }) { ThemeController themeController = Get.find(); @@ -24,7 +24,7 @@ void showDiseaseSelectionDialog( colors?.selectedDiseaseColor ?? themeController.currentColor.sc2; final RxList selectedDiseaseIds = selectedIds.obs; - + title = title.tr; showModalBottomSheet( context: context, backgroundColor: Colors.transparent, diff --git a/lib/pages/sleep_report/chart/LineChartByRange.dart b/lib/pages/sleep_report/chart/LineChartByRange.dart index d6af96c..93b9c80 100644 --- a/lib/pages/sleep_report/chart/LineChartByRange.dart +++ b/lib/pages/sleep_report/chart/LineChartByRange.dart @@ -1,361 +1,3 @@ -// import 'dart:math'; -// import 'dart:ui' as ui; - -// import 'package:ef/ef.dart'; -// import 'package:flutter/material.dart'; -// import 'package:intl/intl.dart'; -// import 'package:vbvs_app/common/util/FitTool.dart'; -// import 'package:vbvs_app/common/util/MyUtils.dart'; - -// class LineChartByRange extends StatefulWidget { -// final List> showLabel; -// final int startTime; -// final int endTime; -// final int? threshold; - -// /// 新增外部指定的 Y 轴最大值 -// final int maxY; - -// /// Y 轴分段数,默认6段 -// final int ySegments; - -// const LineChartByRange({ -// Key? key, -// required this.showLabel, -// required this.startTime, -// required this.endTime, -// required this.maxY, -// this.threshold, -// this.ySegments = 6, -// }) : super(key: key); - -// @override -// State createState() => _LineChartByRangeState(); -// } - -// class _LineChartByRangeState extends State { -// Offset? selectedOffset; -// Map? selectedData; - -// @override -// Widget build(BuildContext context) { -// if (widget.showLabel.isEmpty) return const SizedBox(); - -// DateTime minTime = DateTime.fromMillisecondsSinceEpoch(widget.startTime); -// DateTime maxTime = DateTime.fromMillisecondsSinceEpoch(widget.endTime); - -// return GestureDetector( -// onTapDown: (details) { -// RenderBox box = context.findRenderObject() as RenderBox; -// final localPosition = box.globalToLocal(details.globalPosition); - -// // 查找是否点击到某个点 -// for (var item in widget.showLabel) { -// int start = item['startTime']; -// int end = item['endTime']; -// int times = item['times']; - -// double chartWidth = box.size.width - 40.rpx; // 与 painter 内一致处理 -// double chartHeight = box.size.height - 30.rpx; -// double xStart = 20.rpx + 12.rpx; - -// int totalDuration = -// maxTime.millisecondsSinceEpoch - minTime.millisecondsSinceEpoch; - -// double startX = xStart + -// chartWidth * -// (start - minTime.millisecondsSinceEpoch) / -// totalDuration; -// double y = chartHeight * (1 - times / widget.maxY); - -// // 判断点击范围(圆点半径±6.rpx范围) -// if ((localPosition - Offset(startX, y)).distance < 10.rpx) { -// setState(() { -// selectedOffset = Offset(startX, y); -// selectedData = item; -// }); -// return; -// } - -// double endX = xStart + -// chartWidth * -// (end - minTime.millisecondsSinceEpoch) / -// totalDuration; -// if ((localPosition - Offset(endX, y)).distance < 10.rpx) { -// setState(() { -// selectedOffset = Offset(endX, y); -// selectedData = item; -// }); -// return; -// } -// } - -// // 没点到,清除选中 -// setState(() { -// selectedOffset = null; -// selectedData = null; -// }); -// }, -// child: Stack( -// children: [ -// SizedBox( -// height: 500.rpx, -// child: CustomPaint( -// size: Size(double.infinity, 500.rpx), -// painter: _LineChartByRangePainter( -// data: widget.showLabel, -// maxY: widget.maxY, -// minTime: minTime, -// maxTime: maxTime, -// threshold: widget.threshold, -// ySegments: widget.ySegments, -// ), -// ), -// ), -// if (selectedOffset != null && selectedData != null) -// Positioned( -// left: selectedOffset!.dx - 60.rpx, -// top: selectedOffset!.dy - 50.rpx, -// child: Container( -// padding: -// EdgeInsets.symmetric(horizontal: 12.rpx, vertical: 8.rpx), -// decoration: BoxDecoration( -// color: Colors.black.withOpacity(0.3), -// borderRadius: BorderRadius.circular(10.rpx), -// ), -// child: Text( -// '${DateFormat('HH:mm').format(DateTime.fromMillisecondsSinceEpoch(selectedData!['startTime']))} - ' -// '${DateFormat('HH:mm').format(DateTime.fromMillisecondsSinceEpoch(selectedData!['endTime']))}\n' -// "时长" -// .tr + -// ' ${selectedData!['times']}', -// style: TextStyle( -// fontSize: 18.rpx, -// color: Colors.white, -// ), -// ), -// ), -// ), -// ], -// ), -// ); -// } -// } - -// class _LineChartByRangePainter extends CustomPainter { -// final List> data; -// final int maxY; -// final DateTime minTime; -// final DateTime maxTime; -// final int? threshold; -// final int ySegments; - -// _LineChartByRangePainter({ -// required this.data, -// required this.maxY, -// required this.minTime, -// required this.maxTime, -// this.threshold, -// this.ySegments = 6, -// }); - -// @override -// void paint(Canvas canvas, Size size) { -// double padding = 20.rpx; -// double labelInset = 12.rpx; - -// final double xStart = padding + labelInset; -// final double xEnd = size.width - padding - labelInset; -// final double chartWidth = xEnd - xStart; - -// double chartHeight = size.height - 30.rpx; - -// int totalDuration = -// maxTime.millisecondsSinceEpoch - minTime.millisecondsSinceEpoch; -// if (totalDuration <= 0) return; - -// Paint axisPaint = Paint() -// ..color = Colors.grey.withOpacity(0.4) -// ..strokeWidth = 1.rpx; - -// Paint thresholdPaint = Paint() -// ..color = themeController.currentColor.sc9 -// ..strokeWidth = 1.rpx; - -// // 阈值虚线(红色) -// if (threshold != null && threshold! >= 0 && threshold! <= maxY) { -// double yThreshold = chartHeight * (1 - threshold! / maxY); -// drawDashedLine( -// canvas, -// Offset(xStart, yThreshold), -// Offset(xEnd, yThreshold), -// thresholdPaint, -// dashWidth: 8.rpx, -// dashSpace: 6.rpx, -// ); -// } - -// // 绘制数据线段和圆点 -// for (var item in data) { -// int start = item['startTime']; -// int end = item['endTime']; -// // int times = item['times']; -// int times = item['times']; - -// double startX = xStart * 2 + -// chartWidth * (start - minTime.millisecondsSinceEpoch) / totalDuration; -// double endX = xStart * 2 + -// chartWidth * (end - minTime.millisecondsSinceEpoch) / totalDuration; -// double y = chartHeight * (1 - times / maxY); - -// // 设置颜色(根据 threshold 判断) -// Color pointColor; -// if (threshold != null && times >= threshold!) { -// pointColor = themeController.currentColor.sc9; -// } else { -// pointColor = stringToColor("#00C1AA"); -// } - -// Paint dynamicLinePaint = Paint() -// ..style = PaintingStyle.stroke -// ..strokeWidth = 3.rpx -// ..color = pointColor -// ..strokeCap = StrokeCap.round; - -// Paint dynamicCirclePaint = Paint() -// ..style = PaintingStyle.fill -// ..color = pointColor; - -// // 画线段 -// canvas.drawLine(Offset(startX, y), Offset(endX, y), dynamicLinePaint); - -// // 画起点和终点圆点 -// canvas.drawCircle(Offset(startX, y), 6.rpx, dynamicCirclePaint); -// canvas.drawCircle(Offset(endX, y), 6.rpx, dynamicCirclePaint); -// } - -// // Y轴辅助线和文字 -// for (int i = 0; i <= ySegments; i++) { -// double y = chartHeight * i / ySegments; - -// if (i == ySegments) { -// canvas.drawLine(Offset(xStart, y), Offset(xEnd, y), axisPaint); -// } else { -// drawDashedLine( -// canvas, -// Offset(xStart, y), -// Offset(xEnd, y), -// axisPaint, -// dashWidth: 8.rpx, -// dashSpace: 6.rpx, -// ); -// } - -// TextPainter tp = TextPainter( -// text: TextSpan( -// text: '${maxY - (maxY * i / ySegments).round()}', -// style: TextStyle( -// fontSize: 18.rpx, -// color: themeController.currentColor.sc4, -// ), -// ), -// textDirection: ui.TextDirection.ltr, -// ); -// tp.layout(); -// tp.paint(canvas, Offset(0, y - tp.height / 2)); -// } - -// // X轴主线 -// canvas.drawLine( -// Offset(xStart, chartHeight), -// Offset(xEnd, chartHeight), -// axisPaint, -// ); - -// // X轴时间文字(左右两侧) -// String leftLabel = DateFormat('HH:mm').format(minTime); -// TextPainter leftTp = TextPainter( -// text: TextSpan( -// text: leftLabel, -// style: TextStyle( -// fontSize: 18.rpx, -// color: themeController.currentColor.sc4, -// ), -// ), -// textDirection: ui.TextDirection.ltr, -// ); -// leftTp.layout(); -// leftTp.paint(canvas, -// Offset(padding + labelInset - leftTp.width / 2, chartHeight + 8.rpx)); - -// String rightLabel = DateFormat('HH:mm').format(maxTime); -// TextPainter rightTp = TextPainter( -// text: TextSpan( -// text: rightLabel, -// style: TextStyle( -// fontSize: 18.rpx, -// color: themeController.currentColor.sc4, -// ), -// ), -// textDirection: ui.TextDirection.ltr, -// ); -// rightTp.layout(); -// rightTp.paint( -// canvas, -// Offset(size.width - padding - labelInset - rightTp.width / 2, -// chartHeight + 8.rpx)); - -// // 中间小时刻度 -// int totalHours = maxTime.difference(minTime).inHours + 1; -// int startHour = minTime.hour; - -// for (int i = 1; i < totalHours; i++) { -// double x = xStart + chartWidth * i / totalHours; - -// int hourLabelNum = (startHour + i) % 24; -// String hourLabel = '$hourLabelNum'; - -// TextPainter tp = TextPainter( -// text: TextSpan( -// text: hourLabel, -// style: TextStyle( -// fontSize: 18.rpx, -// color: themeController.currentColor.sc4, -// ), -// ), -// textDirection: ui.TextDirection.ltr, -// ); -// tp.layout(); -// tp.paint(canvas, Offset(x - tp.width / 2, chartHeight + 8.rpx)); -// } -// } - -// @override -// bool shouldRepaint(covariant CustomPainter oldDelegate) => true; - -// void drawDashedLine( -// Canvas canvas, -// Offset start, -// Offset end, -// Paint paint, { -// required double dashWidth, -// required double dashSpace, -// }) { -// final dx = end.dx - start.dx; -// final dy = end.dy - start.dy; -// final distance = sqrt(dx * dx + dy * dy); -// final direction = Offset(dx / distance, dy / distance); - -// double drawn = 0; -// while (drawn < distance) { -// final from = start + direction * drawn; -// final to = start + direction * (drawn + dashWidth).clamp(0, distance); -// canvas.drawLine(from, to, paint); -// drawn += dashWidth + dashSpace; -// } -// } -// } - import 'dart:math'; import 'dart:ui' as ui; @@ -559,10 +201,14 @@ class _LineChartByRangePainter extends CustomPainter { int end = item['endTime']; int times = item['times']; - double startX = xStart * 2 + + double startX = xStart + chartWidth * (start - minTime.millisecondsSinceEpoch) / totalDuration; - double endX = xStart * 2 + + double endX = xStart + chartWidth * (end - minTime.millisecondsSinceEpoch) / totalDuration; + + if (startX == endX) { + endX = startX + 2.rpx; // 至少显示 2.rpx 的线段 + } double y = chartHeight * (1 - times / maxY); // 设置颜色(根据 threshold 判断) diff --git a/lib/pages/sleep_report/component/BreatheStandardWidget.dart b/lib/pages/sleep_report/component/BreatheStandardWidget.dart index b9339f2..2bd197a 100644 --- a/lib/pages/sleep_report/component/BreatheStandardWidget.dart +++ b/lib/pages/sleep_report/component/BreatheStandardWidget.dart @@ -40,33 +40,35 @@ class _BreatheStandardWidgetState extends State { if (dataPoints.isEmpty) { return (8.0, 20.0); } - + // 过滤掉无效数据点(值为-1的) final validPoints = dataPoints.where((point) => point.value >= 0).toList(); - + if (validPoints.isEmpty) { return (8.0, 20.0); } - + // 找出数据中的实际最小值和最大值 - double dataMin = validPoints.map((point) => point.value).reduce((a, b) => a < b ? a : b); - double dataMax = validPoints.map((point) => point.value).reduce((a, b) => a > b ? a : b); - + double dataMin = + validPoints.map((point) => point.value).reduce((a, b) => a < b ? a : b); + double dataMax = + validPoints.map((point) => point.value).reduce((a, b) => a > b ? a : b); + // 设置默认范围 double yMin = 8.0; double yMax = 20.0; - + // 如果数据范围超出了默认范围,则调整 if (dataMin < yMin) { // 最小值为0,不能为负数,且向下浮动2 yMin = (dataMin - 2).clamp(0.0, double.infinity); } - + if (dataMax > yMax) { // 向上浮动2 yMax = dataMax + 2; } - + return (yMin, yMax); } @@ -102,7 +104,7 @@ class _BreatheStandardWidgetState extends State { List> brs = (widget.sleepReport['brs'] as List).cast>(); - + Map? avgBreath = brs.firstWhere( (element) => element['id'] == 307, orElse: () => {}, @@ -139,8 +141,8 @@ class _BreatheStandardWidgetState extends State { width: double.infinity, decoration: BoxDecoration( color: themeController.currentColor.sc5, - borderRadius: BorderRadius.circular( - AppConstants().normal_container_radius), + borderRadius: + BorderRadius.circular(AppConstants().normal_container_radius), ), child: Padding( padding: @@ -205,8 +207,8 @@ class _BreatheStandardWidgetState extends State { } }, child: Container( - padding: EdgeInsetsDirectional.fromSTEB( - 0, 0.rpx, 0.rpx, 0), + padding: + EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0.rpx, 0), width: 28.rpx, height: 28.rpx, child: SvgPicture.asset( @@ -242,8 +244,7 @@ class _BreatheStandardWidgetState extends State { Text( '正常范围'.tr + "${range}", style: TextStyle( - fontSize: - AppConstants().smaller_text_fontSize, + fontSize: AppConstants().smaller_text_fontSize, color: themeController.currentColor.sc3, ), ), @@ -264,150 +265,162 @@ class _BreatheStandardWidgetState extends State { )), ), ), + // Padding( + // padding: + // EdgeInsetsDirectional.fromSTEB(0.rpx, 0.rpx, 0.rpx, 0.rpx), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // children: [ + // Column( + // children: [ + // Text( + // "${avgBreath['name']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: AppConstants().normal_text_fontSize), + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Text( + // "${avgBreath['value']}", + // style: TextStyle( + // color: themeController.currentColor.sc2, + // fontSize: + // AppConstants().normal_text_fontSize), + // ), + // Text( + // "${avgBreath['unit']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: AppConstants().small_text_fontSize), + // ), + // ].divide(SizedBox( + // width: 6.rpx, + // )), + // ), + // ], + // ), + // Column( + // children: [ + // Text( + // "${baseBreath['name']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: AppConstants().normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Text( + // "${baseBreath['value']}", + // style: TextStyle( + // color: themeController.currentColor.sc2, + // fontSize: + // AppConstants().normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Text( + // "${baseBreath['unit']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: AppConstants().small_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // ].divide(SizedBox( + // width: 6.rpx, + // )), + // ), + // ], + // ), + // Column( + // children: [ + // Text( + // "${minBreath['name']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: AppConstants().normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Text( + // "${minBreath['value']}", + // style: TextStyle( + // color: themeController.currentColor.sc2, + // fontSize: + // AppConstants().normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Text( + // "${minBreath['unit']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: AppConstants().small_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // ].divide(SizedBox( + // width: 6.rpx, + // )), + // ), + // ], + // ), + // Column( + // children: [ + // Text( + // "${maxBreath['name']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: AppConstants().normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Text( + // "${maxBreath['value']}", + // style: TextStyle( + // color: themeController.currentColor.sc2, + // fontSize: + // AppConstants().normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Text( + // "${maxBreath['unit']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: AppConstants().small_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // ].divide(SizedBox( + // width: 6.rpx, + // )), + // ), + // ], + // ), + // ], + // ), + // ), Padding( padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 0.rpx, 0.rpx, 0.rpx), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Column( - children: [ - Text( - "${avgBreath['name']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().normal_text_fontSize), - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${avgBreath['value']}", - style: TextStyle( - color: themeController.currentColor.sc2, - fontSize: - AppConstants().normal_text_fontSize), - ), - Text( - "${avgBreath['unit']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().small_text_fontSize), - ), - ].divide(SizedBox( - width: 6.rpx, - )), - ), - ], - ), - Column( - children: [ - Text( - "${baseBreath['name']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${baseBreath['value']}", - style: TextStyle( - color: themeController.currentColor.sc2, - fontSize: - AppConstants().normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - "${baseBreath['unit']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().small_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ].divide(SizedBox( - width: 6.rpx, - )), - ), - ], - ), - Column( - children: [ - Text( - "${minBreath['name']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${minBreath['value']}", - style: TextStyle( - color: themeController.currentColor.sc2, - fontSize: - AppConstants().normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - "${minBreath['unit']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().small_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ].divide(SizedBox( - width: 6.rpx, - )), - ), - ], - ), - Column( - children: [ - Text( - "${maxBreath['name']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${maxBreath['value']}", - style: TextStyle( - color: themeController.currentColor.sc2, - fontSize: - AppConstants().normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - "${maxBreath['unit']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().small_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ].divide(SizedBox( - width: 6.rpx, - )), - ), - ], - ), + _buildBreathItem(avgBreath), + _buildBreathItem(baseBreath), + _buildBreathItem(minBreath), + _buildBreathItem(maxBreath), ], ), ), @@ -420,4 +433,70 @@ class _BreatheStandardWidgetState extends State { return Container(); } } -} \ No newline at end of file + + Widget _buildBreathItem(Map data) { + return Expanded( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 4.rpx, vertical: 4.rpx), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // 名称 - 最多2行 + Flexible( + child: Text( + "${data['name']}", + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().normal_text_fontSize, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + ), + ), + SizedBox(height: 4.rpx), + // 值 + 单位 - 最多2行 + Flexible( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Flexible( + fit: FlexFit.loose, + child: Text( + "${data['value']}", + style: TextStyle( + color: themeController.currentColor.sc2, + fontSize: AppConstants().normal_text_fontSize, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + ), + ), + SizedBox(width: 4.rpx), + Flexible( + fit: FlexFit.loose, + child: Text( + "${data['unit']}", + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().small_text_fontSize, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/sleep_report/component/DiseasePercentsWidget.dart b/lib/pages/sleep_report/component/DiseasePercentsWidget.dart index 99f4aaf..aead7fc 100644 --- a/lib/pages/sleep_report/component/DiseasePercentsWidget.dart +++ b/lib/pages/sleep_report/component/DiseasePercentsWidget.dart @@ -61,11 +61,15 @@ class _DiseasePercentsWidgetState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - "慢性病风险指数".tr, - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().title_text_fontSize), + Expanded( + child: Text( + "慢性病风险指数".tr, + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().title_text_fontSize), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), ), ClickableContainer( backgroundColor: Colors.transparent, @@ -76,7 +80,8 @@ class _DiseasePercentsWidgetState extends State { onTap: () { // 你的点击逻辑 - if (AppConstants().ent_type == APPPackageType.MHT.code) { + if (AppConstants().ent_type == + APPPackageType.MHT.code) { showTipDialog( context, Container( diff --git a/lib/pages/sleep_report/component/HeartChangeWidget.dart b/lib/pages/sleep_report/component/HeartChangeWidget.dart index 3c97d85..dea6026 100644 --- a/lib/pages/sleep_report/component/HeartChangeWidget.dart +++ b/lib/pages/sleep_report/component/HeartChangeWidget.dart @@ -63,11 +63,15 @@ class _HeartChangeWidgetState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - "心率变异性(HRV)".tr, - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().title_text_fontSize), + Expanded( + child: Text( + "心率变异性(HRV)".tr, + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().title_text_fontSize), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), ), ClickableContainer( backgroundColor: Colors.transparent, diff --git a/lib/pages/sleep_report/component/HeartHealthWidget.dart b/lib/pages/sleep_report/component/HeartHealthWidget.dart index f20488a..265b3c9 100644 --- a/lib/pages/sleep_report/component/HeartHealthWidget.dart +++ b/lib/pages/sleep_report/component/HeartHealthWidget.dart @@ -82,7 +82,6 @@ class _HeartHealthWidgetState extends State { context, Container( child: Text( - // "心理健康评估介绍".tr, "心率健康评估主要通过用户睡眠报告中的时间点、体征数据及HRV数据等信息,来判断其心理健康水平、疲劳程度。" .tr, style: TextStyle( @@ -140,11 +139,17 @@ class _HeartHealthWidgetState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - FatigueCircleIndicator( - data: showLabel[0], + Flexible( + flex: 1, + child: FatigueCircleIndicator( + data: showLabel[0], + ), ), - FatigueCircleIndicator( - data: showLabel[1], + Flexible( + flex: 1, + child: FatigueCircleIndicator( + data: showLabel[1], + ), ), ].divide(SizedBox( width: 110.rpx, diff --git a/lib/pages/sleep_report/component/HeartPointWidget.dart b/lib/pages/sleep_report/component/HeartPointWidget.dart index f97c8a7..ec7b242 100644 --- a/lib/pages/sleep_report/component/HeartPointWidget.dart +++ b/lib/pages/sleep_report/component/HeartPointWidget.dart @@ -82,11 +82,15 @@ class _HeartPointWidgetState extends State { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - "心率散点图".tr, - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().title_text_fontSize), + Expanded( + child: Text( + "心率散点图".tr, + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().title_text_fontSize), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), ), ClickableContainer( backgroundColor: Colors.transparent, diff --git a/lib/pages/sleep_report/component/HeartRateStandardWidget.dart b/lib/pages/sleep_report/component/HeartRateStandardWidget.dart index a29393b..5fd8f66 100644 --- a/lib/pages/sleep_report/component/HeartRateStandardWidget.dart +++ b/lib/pages/sleep_report/component/HeartRateStandardWidget.dart @@ -249,158 +249,170 @@ class _HeartRateStandardWidgetState extends State { // actYMax: max.toDouble(), ), ), + // Padding( + // padding: EdgeInsetsDirectional.fromSTEB( + // 30.rpx, 0.rpx, 0.rpx, 0.rpx), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.spaceAround, + // children: [ + // Column( + // children: [ + // Text( + // "${avgHeartRate['name']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: + // AppConstants().normal_text_fontSize), + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Text( + // "${avgHeartRate['value']}", + // style: TextStyle( + // color: themeController.currentColor.sc2, + // fontSize: AppConstants() + // .normal_text_fontSize), + // ), + // Text( + // "${avgHeartRate['unit']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: + // AppConstants().small_text_fontSize), + // ), + // ].divide(SizedBox( + // width: 6.rpx, + // )), + // ), + // ], + // ), + // Column( + // children: [ + // Text( + // "${baseHeartRate['name']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: + // AppConstants().normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Text( + // "${baseHeartRate['value']}", + // style: TextStyle( + // color: themeController.currentColor.sc2, + // fontSize: AppConstants() + // .normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Text( + // "${baseHeartRate['unit']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: + // AppConstants().small_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // ].divide(SizedBox( + // width: 6.rpx, + // )), + // ), + // ], + // ), + // Column( + // children: [ + // Text( + // "${minHeartRate['name']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: + // AppConstants().normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Text( + // "${minHeartRate['value']}", + // style: TextStyle( + // color: themeController.currentColor.sc2, + // fontSize: AppConstants() + // .normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Text( + // "${minHeartRate['unit']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: + // AppConstants().small_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // ].divide(SizedBox( + // width: 6.rpx, + // )), + // ), + // ], + // ), + // Column( + // children: [ + // Text( + // "${maxHeartRate['name']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: + // AppConstants().normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Row( + // crossAxisAlignment: CrossAxisAlignment.end, + // children: [ + // Text( + // "${maxHeartRate['value']}", + // style: TextStyle( + // color: themeController.currentColor.sc2, + // fontSize: AppConstants() + // .normal_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // Text( + // "${maxHeartRate['unit']}", + // style: TextStyle( + // color: themeController.currentColor.sc3, + // fontSize: + // AppConstants().small_text_fontSize), + // maxLines: 1, + // overflow: TextOverflow.ellipsis, + // ), + // ].divide(SizedBox( + // width: 6.rpx, + // )), + // ), + // ], + // ), + // ], + // ), + // ), Padding( padding: EdgeInsetsDirectional.fromSTEB( 30.rpx, 0.rpx, 0.rpx, 0.rpx), child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - Column( - children: [ - Text( - "${avgHeartRate['name']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: - AppConstants().normal_text_fontSize), - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${avgHeartRate['value']}", - style: TextStyle( - color: themeController.currentColor.sc2, - fontSize: AppConstants() - .normal_text_fontSize), - ), - Text( - "${avgHeartRate['unit']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: - AppConstants().small_text_fontSize), - ), - ].divide(SizedBox( - width: 6.rpx, - )), - ), - ], - ), - Column( - children: [ - Text( - "${baseHeartRate['name']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: - AppConstants().normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${baseHeartRate['value']}", - style: TextStyle( - color: themeController.currentColor.sc2, - fontSize: AppConstants() - .normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - "${baseHeartRate['unit']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: - AppConstants().small_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ].divide(SizedBox( - width: 6.rpx, - )), - ), - ], - ), - Column( - children: [ - Text( - "${minHeartRate['name']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: - AppConstants().normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${minHeartRate['value']}", - style: TextStyle( - color: themeController.currentColor.sc2, - fontSize: AppConstants() - .normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - "${minHeartRate['unit']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: - AppConstants().small_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ].divide(SizedBox( - width: 6.rpx, - )), - ), - ], - ), - Column( - children: [ - Text( - "${maxHeartRate['name']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: - AppConstants().normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Row( - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Text( - "${maxHeartRate['value']}", - style: TextStyle( - color: themeController.currentColor.sc2, - fontSize: AppConstants() - .normal_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - Text( - "${maxHeartRate['unit']}", - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: - AppConstants().small_text_fontSize), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ].divide(SizedBox( - width: 6.rpx, - )), - ), - ], - ), + _buildHeartRateItem(avgHeartRate), + _buildHeartRateItem(baseHeartRate), + _buildHeartRateItem(minHeartRate), + _buildHeartRateItem(maxHeartRate), ], ), ), @@ -418,4 +430,70 @@ class _HeartRateStandardWidgetState extends State { return Container(); } } + + Widget _buildHeartRateItem(Map data) { + return Expanded( + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 4.rpx, vertical: 4.rpx), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // 名称 - 最多2行 + Flexible( + child: Text( + "${data['name']}", + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().normal_text_fontSize, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + ), + ), + SizedBox(height: 4.rpx), + // 值 + 单位 - 最多2行 + Flexible( + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + Flexible( + fit: FlexFit.loose, + child: Text( + "${data['value']}", + style: TextStyle( + color: themeController.currentColor.sc2, + fontSize: AppConstants().normal_text_fontSize, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + ), + ), + SizedBox(width: 6.rpx), + Flexible( + fit: FlexFit.loose, + child: Text( + "${data['unit']}", + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().small_text_fontSize, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + textAlign: TextAlign.center, + ), + ), + ], + ), + ), + ], + ), + ), + ); + } } diff --git a/lib/pages/sleep_report/component/SkinPercentWidget.dart b/lib/pages/sleep_report/component/SkinPercentWidget.dart index 2f9af60..d9a4b17 100644 --- a/lib/pages/sleep_report/component/SkinPercentWidget.dart +++ b/lib/pages/sleep_report/component/SkinPercentWidget.dart @@ -97,7 +97,6 @@ class _SkinPercentWidgetState extends State { context, Container( child: Text( - // "心理健康评估介绍".tr, "皮肤指数通过用户睡眠过程中的体征数据,计算皮肤电反应,生成综合评估指标,用于睡眠中的生理应激状态或自主神经活动。" .tr, style: TextStyle( diff --git a/lib/pages/sleep_report/component/SleepChartWidget.dart b/lib/pages/sleep_report/component/SleepChartWidget.dart index 08929b2..ef0c44d 100644 --- a/lib/pages/sleep_report/component/SleepChartWidget.dart +++ b/lib/pages/sleep_report/component/SleepChartWidget.dart @@ -37,11 +37,15 @@ class SleepChartContainer extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - title, - style: TextStyle( - color: Colors.white, - fontSize: 30.rpx, + Expanded( + child: Text( + title, + style: TextStyle( + color: Colors.white, + fontSize: 30.rpx, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), ClickableContainer( diff --git a/lib/pages/sleep_report/component/SleepScoreWidget.dart b/lib/pages/sleep_report/component/SleepScoreWidget.dart index 1ed1583..bd3d99a 100644 --- a/lib/pages/sleep_report/component/SleepScoreWidget.dart +++ b/lib/pages/sleep_report/component/SleepScoreWidget.dart @@ -158,6 +158,8 @@ class _SleepScoreWidgetState extends State { fontSize: AppConstants().normal_text_fontSize, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), Text( diff --git a/lib/pages/sleep_report/component/SnoreViewWidget.dart b/lib/pages/sleep_report/component/SnoreViewWidget.dart index 60c5b4a..fc31243 100644 --- a/lib/pages/sleep_report/component/SnoreViewWidget.dart +++ b/lib/pages/sleep_report/component/SnoreViewWidget.dart @@ -1,380 +1,3 @@ -// import 'package:EasyDartModule/EasyDartModule.dart' as es; -// import 'package:ef/ef.dart'; -// import 'package:flutter/material.dart'; -// import 'package:flutter_svg/svg.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/component/tool/ClickableContainer.dart'; -// import 'package:vbvs_app/enum/APPPackageType.dart'; -// import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart'; -// import 'package:vbvs_app/pages/sleep_report/chart/SnoreChart.dart'; - -// class SnoreViewWidgetWidget extends StatefulWidget { -// var sleepReport; -// SnoreViewWidgetWidget({super.key, required this.sleepReport}); - -// @override -// State createState() => _SnoreViewWidgetWidgetState(); -// } - -// class _SnoreViewWidgetWidgetState extends State { -// @override -// void setState(VoidCallback callback) { -// super.setState(callback); -// } - -// @override -// void initState() { -// super.initState(); -// } - -// @override -// void dispose() { -// super.dispose(); -// } - -// @override -// Widget build(BuildContext context) { -// try { -// if (widget.sleepReport == null || -// widget.sleepReport is! Map || -// widget.sleepReport.isEmpty) { -// return Container(); -// } -// // if (APPPackageType.TH.code == AppConstants().ent_type) { -// // return Container(); -// // } -// double maxY = 250; -// var startTime = widget.sleepReport['startTime']; -// var endTime = widget.sleepReport['endTime']; -// List snoreValues = []; - -// List type = widget.sleepReport['ssp']['type']; -// List lightSnore = widget.sleepReport['ssp']['data'][0]; -// List heavySnore = widget.sleepReport['ssp']['data'][1]; - -// // lightSnore = [ -// // ...lightSnore, -// // { -// // 'st': widget.sleepReport['startTime'] + 2 * 60 * 60 * 1000, // 开始后2小时 -// // 'et': widget.sleepReport['startTime'] + 2 * 60 * 65 * 1000, // 持续5分钟 -// // 'value': 25, -// // }, -// // { -// // 'st': widget.sleepReport['startTime'] + 4 * 60 * 60 * 1000, // 开始后4小时 -// // 'et': widget.sleepReport['startTime'] + 4 * 60 * 68 * 1000, // 持续8分钟 -// // 'value': 18, -// // } -// // ]; - -// // // 添加模拟数据到重度打鼾列表 -// // heavySnore = [ -// // ...heavySnore, -// // { -// // 'st': widget.sleepReport['startTime'] + 3 * 60 * 60 * 1000, // 开始后3小时 -// // 'et': widget.sleepReport['startTime'] + 3 * 60 * 62 * 1000, // 持续2分钟 -// // 'value': 68, -// // }, -// // { -// // 'st': widget.sleepReport['startTime'] + 5 * 60 * 60 * 1000, // 开始后5小时 -// // 'et': widget.sleepReport['startTime'] + 5 * 60 * 64 * 1000, // 持续4分钟 -// // 'value': 72, -// // } -// // ]; - -// List processedLightSnore = lightSnore.map((item) { -// return { -// ...item, -// 'id': type[0]['id'], -// 'name': type[0]['name'], -// 'color': type[0]['color'], -// }; -// }).toList(); - -// List processedHeavySnore = heavySnore.map((item) { -// return { -// ...item, -// 'id': type[1]['id'], -// 'name': type[1]['name'], -// 'color': type[1]['color'], -// }; -// }).toList(); - -// snoreValues = [...processedLightSnore, ...processedHeavySnore]; -// snoreValues.sort((a, b) => a['st'].compareTo(b['st'])); -// print(snoreValues); -// List barDataList = snoreValues.map((item) { -// return BarData( -// st: item['st'], -// et: item['et'], -// value: (item['value'] as num).toDouble() > maxY -// ? maxY + 3 -// : (item['value'] as num).toDouble(), -// id: item['id'], -// name: item['name'], -// color: (item['color'] == null || item['color'].isEmpty) -// ? (item['id'] == 1 ? Colors.green : Colors.red) -// : stringToColor(item['color']), -// ); -// }).toList(); - -// // List> data = -// // (widget.sleepReport['ssp'] as List).cast>(); -// // List> showLabel = convertToShowLabel(data); - -// return Container( -// width: double.infinity, -// decoration: BoxDecoration( -// color: themeController.currentColor.sc5, -// borderRadius: BorderRadius.circular( -// AppConstants().normal_container_radius), // 你可以按需调整圆角半径 -// ), -// child: Padding( -// padding: -// EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 0.rpx), -// child: Column( -// mainAxisSize: MainAxisSize.max, -// children: [ -// Container( -// child: Row( -// mainAxisAlignment: MainAxisAlignment.spaceBetween, -// children: [ -// Text( -// "打鼾监测".tr, -// style: TextStyle( -// color: themeController.currentColor.sc3, -// fontSize: AppConstants().title_text_fontSize), -// ), -// ClickableContainer( -// backgroundColor: Colors.transparent, -// highlightColor: Colors.white, // 或设置为你需要的水波纹颜色 -// padding: EdgeInsetsDirectional.fromSTEB( -// 14.rpx, 10.rpx, 14.rpx, 10.rpx), // -// borderRadius: 0.rpx, // 圆形点击区域 -// onTap: () { -// if (AppConstants().ent_type == -// APPPackageType.MHT.code) { -// showTipDialog( -// context, -// Container( -// child: Text( -// // "打鼾监测介绍。", -// "打鼾监测是指用户在睡眠过程中打鼾频次的图表说明。".tr, -// style: TextStyle( -// fontSize: 26.rpx, -// color: Colors.black, -// ), -// ), -// ), -// backgroundColor: Color(0xFFFFFFFF), -// colors: [ -// Color(0XFF1592AA), -// Color(0xFF0C83A7), -// Color(0xFF006FA3) -// ], -// ); -// } else { -// showTipDialog( -// context, -// Container( -// child: Text( -// "打鼾监测是指用户在睡眠过程中打鼾频次的图表说明。".tr, -// style: TextStyle( -// fontSize: 26.rpx, -// color: themeController.currentColor.sc3, -// ), -// ), -// ), -// backgroundColor: themeController.currentColor.sc17, -// colors: AppConstants().thNormalButton, -// ); -// } -// }, -// child: Container( -// padding: EdgeInsetsDirectional.fromSTEB( -// 0, 0.rpx, 0.rpx, 0), // 外部 padding 移到内部 -// width: 28.rpx, -// height: 28.rpx, -// child: SvgPicture.asset( -// 'assets/img/icon/explain.svg', -// fit: BoxFit.cover, -// color: themeController.currentColor.sc4, -// ), -// ), -// ), -// ], -// ), -// ), -// SizedBox( -// height: 32.rpx, -// ), -// Row( -// children: [ -// Text( -// "次".tr, -// style: TextStyle( -// color: stringToColor("#FFFFFF"), fontSize: 18.rpx), -// ), -// ], -// ), -// Padding( -// padding: EdgeInsetsDirectional.fromSTEB( -// 0.rpx, 40.rpx, 20.rpx, 0.rpx), -// // child: LineChartByRange( -// // showLabel: showLabel, -// // startTime: startTime, -// // endTime: endTime, -// // ), -// child: BarChartWidget( -// data: barDataList, -// startTime: startTime, -// endTime: endTime, -// maxYValue: maxY, // 最大值可自定义 -// yStepCount: 3, // 分4段(0, 5, 10, 15, 20) -// ), -// ), -// Padding( -// padding: -// EdgeInsetsDirectional.fromSTEB(0.rpx, 52.rpx, 0.rpx, 0.rpx), -// child: Container( -// child: Row( -// mainAxisAlignment: MainAxisAlignment.spaceAround, -// children: [ -// Column( -// crossAxisAlignment: CrossAxisAlignment.center, // 左对齐 -// children: [ -// Row( -// children: [ -// // 小圆球 -// Container( -// width: 14.rpx, -// height: 14.rpx, -// decoration: BoxDecoration( -// color: (type[0]?['color'] == null || -// type[0]?['color'].isEmpty) -// ? Colors.green -// : stringToColor( -// "${type[0]['color']}"), // 你想要的颜色 -// shape: BoxShape.circle, -// ), -// ), -// SizedBox(width: 12.rpx), // 小圆球和文字间距 -// Text( -// '${type[0]?['name']}', -// style: TextStyle( -// fontSize: -// AppConstants().normal_text_fontSize, -// color: themeController.currentColor.sc3), -// ), -// ], -// ), -// SizedBox(height: 16.rpx), // 两行文字间距 -// Text( -// '${(type[0]?['value'] == null || type[0]['value'].toString().isEmpty) ? '未知数据'.tr : '${type[0]?['value']}${(type[0]?['unit'] == null || type[0]['unit'].toString().isEmpty) ? '' : type[0]?['unit']}'}', -// style: TextStyle( -// fontSize: AppConstants().small_text_fontSize, -// color: themeController.currentColor.sc4), -// ), -// ], -// ), -// Column( -// crossAxisAlignment: CrossAxisAlignment.center, // 左对齐 -// children: [ -// Row( -// children: [ -// // 小圆球 -// Container( -// width: 14.rpx, -// height: 14.rpx, -// decoration: BoxDecoration( -// color: (type[1]?['color'] == null || -// type[1]?['color'].isEmpty) -// ? Colors.red -// : stringToColor( -// "${type[1]['color']}"), // 你想要的颜色 -// shape: BoxShape.circle, -// ), -// ), -// SizedBox(width: 12.rpx), // 小圆球和文字间距 -// Text( -// '${type[1]?['name']}', -// style: TextStyle( -// fontSize: -// AppConstants().normal_text_fontSize, -// color: themeController.currentColor.sc3), -// ), -// ], -// ), -// SizedBox(height: 16.rpx), // 两行文字间距 -// Text( -// '${(type[1]?['value'] == null || type[1]['value'].toString().isEmpty) ? '未知数据'.tr : '${type[1]?['value']}${(type[1]?['unit'] == null || type[1]['unit'].toString().isEmpty) ? '' : type[1]?['unit']}'}', -// style: TextStyle( -// fontSize: AppConstants().small_text_fontSize, -// color: themeController.currentColor.sc4), -// ), -// ], -// ), -// ], -// ), -// ), -// ), -// SizedBox( -// height: 52.rpx, -// ), -// ], -// ), -// ), -// ); -// } catch (e) { -// es.EasyDartModule.logger.error("打鼾监测绘制异常${e}"); -// return Container(); -// } -// } - -// List> convertToShowLabel( -// List> data) { -// if (data.isEmpty) return []; - -// data.sort((a, b) => a['st'].compareTo(b['st'])); // 确保时间有序 - -// List> result = []; - -// int startTime = data[0]['st']; -// int endTime = data[0]['et']; -// int currentValue = data[0]['value']; - -// for (int i = 1; i < data.length; i++) { -// final item = data[i]; -// final st = item['st']; -// final value = item['value']; -// final et = item['et']; - -// if (value == currentValue) { -// endTime = st; -// } else { -// result.add({ -// "startTime": startTime, -// "endTime": endTime, -// "times": currentValue, -// }); -// startTime = st; -// endTime = et; -// currentValue = value; -// } -// } - -// // 添加最后一段 -// result.add({ -// "startTime": startTime, -// "endTime": endTime, -// "times": currentValue, -// }); - -// return result; -// } -// } - import 'package:EasyDartModule/EasyDartModule.dart' as es; import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; diff --git a/lib/pages/sleep_report/component/TrendDataTablePage.dart b/lib/pages/sleep_report/component/TrendDataTablePage.dart index 04e9845..1018ddd 100644 --- a/lib/pages/sleep_report/component/TrendDataTablePage.dart +++ b/lib/pages/sleep_report/component/TrendDataTablePage.dart @@ -42,11 +42,15 @@ class _TrendDataTablePageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - widget.title, - style: TextStyle( - color: Colors.white, - fontSize: 30.rpx, + Expanded( + child: Text( + widget.title, + style: TextStyle( + color: Colors.white, + fontSize: 30.rpx, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), ClickableContainer( diff --git a/lib/pages/sleep_report/component/TrendDataTextPage.dart b/lib/pages/sleep_report/component/TrendDataTextPage.dart index 1f94d6a..dd2a4b7 100644 --- a/lib/pages/sleep_report/component/TrendDataTextPage.dart +++ b/lib/pages/sleep_report/component/TrendDataTextPage.dart @@ -47,11 +47,15 @@ class IndicatorCompareCard extends StatelessWidget { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - title.tr, - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().title_text_fontSize, + Expanded( + child: Text( + title.tr, + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().title_text_fontSize, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), if (tooltip != null) diff --git a/lib/pages/sleep_report/component/Vital_signs.dart b/lib/pages/sleep_report/component/Vital_signs.dart index 1aa7cfe..a5efbbf 100644 --- a/lib/pages/sleep_report/component/Vital_signs.dart +++ b/lib/pages/sleep_report/component/Vital_signs.dart @@ -181,7 +181,7 @@ class _VitalSignsWidgetState extends State { 'person_show': false, 'itemName': 206, 'retrun_fresh': true, - 'reportPadding':false, + 'reportPadding': false, }); if (widget.onRefresh != null) { widget.onRefresh!(); @@ -247,6 +247,8 @@ class _VitalSignsWidgetState extends State { color: stringToColor("#929699"), fontSize: AppConstants().normal_text_fontSize, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ], ), diff --git a/lib/pages/sleep_report/component/ZiZhuShenJingPercentWidget.dart b/lib/pages/sleep_report/component/ZiZhuShenJingPercentWidget.dart index 48928f0..7262211 100644 --- a/lib/pages/sleep_report/component/ZiZhuShenJingPercentWidget.dart +++ b/lib/pages/sleep_report/component/ZiZhuShenJingPercentWidget.dart @@ -82,11 +82,15 @@ class _ZiZhuShenJingPercentWidgetState child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - "自主神经平衡指数".tr, - style: TextStyle( - color: themeController.currentColor.sc3, - fontSize: AppConstants().title_text_fontSize), + Expanded( + child: Text( + "自主神经平衡指数".tr, + style: TextStyle( + color: themeController.currentColor.sc3, + fontSize: AppConstants().title_text_fontSize), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), ), ClickableContainer( backgroundColor: Colors.transparent, @@ -95,7 +99,8 @@ class _ZiZhuShenJingPercentWidgetState 14.rpx, 10.rpx, 14.rpx, 10.rpx), // borderRadius: 0.rpx, // 圆形点击区域 onTap: () { - if (AppConstants().ent_type == APPPackageType.MHT.code) { + if (AppConstants().ent_type == + APPPackageType.MHT.code) { showTipDialog( context, Container( diff --git a/lib/pages/sleep_report/new_sleep_report_page.dart b/lib/pages/sleep_report/new_sleep_report_page.dart index 7fbf6be..8a032e7 100644 --- a/lib/pages/sleep_report/new_sleep_report_page.dart +++ b/lib/pages/sleep_report/new_sleep_report_page.dart @@ -1440,6 +1440,8 @@ class _NewSleepReportPageState extends State { ? themeController.currentColor.sc2 : themeController.currentColor.sc3, ), + maxLines: 1, + overflow: TextOverflow.ellipsis, ), ), SizedBox(height: 10.rpx), diff --git a/pubspec.yaml b/pubspec.yaml index e52ab25..a4735be 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -88,6 +88,9 @@ dependencies: ref: main open_file: ^3.5.11 device_info_plus: ^10.0.0 + wifi_scan: ^0.4.1+2 + network_info_plus: ^5.0.1 + # wifi_info_flutter: ^2.0.2 dev_dependencies: