diff --git a/assets/langs/en_US.json b/assets/langs/en_US.json index beb7926..3317be9 100644 --- a/assets/langs/en_US.json +++ b/assets/langs/en_US.json @@ -248,7 +248,7 @@ "必须登录提示": "Please login first!", "待开发功能": "New feature coming soon", "未知数据": "Unknown", - "在离床": "In/Out of bed", + "在离床": "In/Out", "体动": "Motion", "心率": "Heart rate", "打鼾": "Snoring", @@ -289,8 +289,8 @@ "设备升级": "Device upgrade", "设备故障": "Device malfunction!", "是否在床": "In bed:", - "在床": "In bed", - "离床": "Out of bed", + "在床": "In", + "离床": "Out", "较弱": "Weak", "弱": "Fair", "一般": "Average", diff --git a/lib/controller/weather/weather_controller.dart b/lib/controller/weather/weather_controller.dart index 0f91d0e..1380a42 100644 --- a/lib/controller/weather/weather_controller.dart +++ b/lib/controller/weather/weather_controller.dart @@ -60,7 +60,7 @@ class WeatherModelController extends GetControllerEx { try { await _getCurrentLocation(); _weatherTimer = Timer.periodic(Duration(seconds: 5), (timer) { - _getCurrentWeather(); // 每 5 秒更新一次天气 + getCurrentWeather(); // 每 5 秒更新一次天气 }); _locationTimer = Timer.periodic(Duration(minutes: 10), (timer) { @@ -116,7 +116,7 @@ class WeatherModelController extends GetControllerEx { } // 调用获取天气方法 - _getCurrentWeather(); + getCurrentWeather(); } catch (e) { print(e); EasyDartModule.logger.error("获取位置失败: $e"); @@ -168,15 +168,15 @@ class WeatherModelController extends GetControllerEx { } // 获取天气信息 - Future _getCurrentWeather() async { + Future getCurrentWeather() async { if (model.latitude == null || model.longitude == null) { EasyDartModule.logger.error("获取天气失败:位置数据获取失败"); return; // 如果位置数据没有获取到,则不更新天气 } - String? language = "zh_CN"; - if (languageController.selectLanguage != null) { - language = languageController.selectLanguage.value!.language_code; - } + // String? language = "zh_CN"; + // if (languageController.selectLanguage != null) { + // language = languageController.selectLanguage.value!.language_code; + // } List placemarks = []; // placemarks = await placemarkFromCoordinates(model.latitude!, model.longitude!, // localeIdentifier: language); diff --git a/lib/pages/device/component/DeviceStatusInfoWidget.dart b/lib/pages/device/component/DeviceStatusInfoWidget.dart index 3980db4..0eeadb3 100644 --- a/lib/pages/device/component/DeviceStatusInfoWidget.dart +++ b/lib/pages/device/component/DeviceStatusInfoWidget.dart @@ -59,7 +59,7 @@ class DeviceStatusInfoWidget extends StatelessWidget { // ), ), Text( - value, + value.tr, style: TextStyle( fontFamily: 'Inter', fontSize: 48.rpx, @@ -72,7 +72,7 @@ class DeviceStatusInfoWidget extends StatelessWidget { .addToStart(SizedBox(width: 31.rpx)), ), Text( - title, + title.tr, style: TextStyle( fontFamily: 'Inter', fontSize: 30.rpx, diff --git a/lib/pages/device/instant_body_page.dart b/lib/pages/device/instant_body_page.dart index f99c083..55074fa 100644 --- a/lib/pages/device/instant_body_page.dart +++ b/lib/pages/device/instant_body_page.dart @@ -123,18 +123,23 @@ class _InstantBodyPageState extends State CommonVariables.callMap["/vsbs/web/rt/marttress"] = (data) { inBed = data["inBed"]; // 心率 呼吸 体动 呼吸暂停 - if ("离床" == inBed) { - breathState = "否"; + if ("离床".tr == inBed) { + breathState = "否".tr; bodyMotion = 0; breathrate = 0; heartrate = 0; - snores = "否"; + snores = "否".tr; } else { - breathState = data["breathState"]; - bodyMotion = data['bodyMotion']; - breathrate = data["breathRate"]; - heartrate = data['heartRate']; - snores = data['snores']; + breathState = data["breathState"] == null || data["breathState"] == "" + ? "-" + : data["breathState"].toString().tr; + + bodyMotion = data['bodyMotion'] == null ? 0 : data['bodyMotion']; + breathrate = data["breathRate"] == null ? 0 : data["breathRate"]; + heartrate = data['heartRate'] == null ? 0 : data['heartRate']; + snores = data['snores'] == null || data['snores'] == "" + ? "否".tr + : data['snores'].tr; } if (mounted) { @@ -142,7 +147,6 @@ class _InstantBodyPageState extends State onlineState = "在线".tr; // 接收到数据,设置为在线 }); } - _startOnlineTimer(); // 重置定时器 }; @@ -184,7 +188,7 @@ class _InstantBodyPageState extends State TextSpan( text: "(${onlineState})", style: TextStyle( - color: onlineState == '在线' + color: onlineState == '在线'.tr ? themeController.currentColor.sc2 : themeController .currentColor.sc9, // 👈 单独设置颜色 @@ -454,7 +458,7 @@ class _InstantBodyPageState extends State title: "体动".tr, iconAsset: "assets/img/icon/bodymotion.svg", - value: inBed == "离床" + value: inBed == "离床".tr ? ("-") : (bodyMotion == null || bodyMotion == -1) @@ -471,7 +475,7 @@ class _InstantBodyPageState extends State title: "心率".tr, iconAsset: "assets/img/icon/heart.svg", - value: inBed == "离床" + value: inBed == "离床".tr ? "-" : ((heartrate == null || heartrate == -1) @@ -482,7 +486,7 @@ class _InstantBodyPageState extends State title: "打鼾".tr, iconAsset: "assets/img/icon/snore.svg", - value: inBed == "离床" + value: inBed == "离床".tr ? "-" : ('${snores}'.tr), ), @@ -496,7 +500,7 @@ class _InstantBodyPageState extends State title: "呼吸".tr, iconAsset: "assets/img/icon/breathe.svg", - value: inBed == "离床" + value: inBed == "离床".tr ? ("-") : ((breathrate == null || breathrate == -1) @@ -507,7 +511,7 @@ class _InstantBodyPageState extends State title: "呼吸暂停".tr, iconAsset: "assets/img/icon/breathe_pause.svg", - value: inBed == "离床" + value: inBed == "离床".tr ? "-" : ('${breathState}'), ), diff --git a/lib/pages/login/other_login.dart b/lib/pages/login/other_login.dart index 46bbc99..3024df6 100644 --- a/lib/pages/login/other_login.dart +++ b/lib/pages/login/other_login.dart @@ -951,52 +951,52 @@ class _OtherLoginPageState extends State { ), ), ), - ClickableContainer( - backgroundColor: Colors.white, - highlightColor: Colors.grey, - borderRadius: 999.rpx, - padding: EdgeInsets.zero, - onTap: () { - TopSlideNotification.show(context, - text: "待开发功能".tr); - }, - child: Container( - width: 91.rpx, - height: 91.rpx, - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - shape: BoxShape.circle, - ), - child: Image.asset( - "assets/img/tel.png", - width: 30.rpx, - height: 30.rpx, - ), - ), - ), - ClickableContainer( - backgroundColor: Colors.white, - highlightColor: Colors.grey, - borderRadius: 999.rpx, - padding: EdgeInsets.zero, - onTap: () { - TopSlideNotification.show(context, - text: "待开发功能".tr); - }, - child: Container( - width: 91.rpx, - height: 91.rpx, - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - shape: BoxShape.circle, - ), - child: Image.asset( - "assets/img/google.png", - width: 30.rpx, - height: 30.rpx, - ), - ), - ), + // ClickableContainer( + // backgroundColor: Colors.white, + // highlightColor: Colors.grey, + // borderRadius: 999.rpx, + // padding: EdgeInsets.zero, + // onTap: () { + // TopSlideNotification.show(context, + // text: "待开发功能".tr); + // }, + // child: Container( + // width: 91.rpx, + // height: 91.rpx, + // clipBehavior: Clip.antiAlias, + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // ), + // child: Image.asset( + // "assets/img/tel.png", + // width: 30.rpx, + // height: 30.rpx, + // ), + // ), + // ), + // ClickableContainer( + // backgroundColor: Colors.white, + // highlightColor: Colors.grey, + // borderRadius: 999.rpx, + // padding: EdgeInsets.zero, + // onTap: () { + // TopSlideNotification.show(context, + // text: "待开发功能".tr); + // }, + // child: Container( + // width: 91.rpx, + // height: 91.rpx, + // clipBehavior: Clip.antiAlias, + // decoration: BoxDecoration( + // shape: BoxShape.circle, + // ), + // child: Image.asset( + // "assets/img/google.png", + // width: 30.rpx, + // height: 30.rpx, + // ), + // ), + // ), ].divide(SizedBox(width: 35.rpx)), ), ], diff --git a/lib/pages/setting/language_setting.dart b/lib/pages/setting/language_setting.dart index b10c8be..c97aaf1 100644 --- a/lib/pages/setting/language_setting.dart +++ b/lib/pages/setting/language_setting.dart @@ -7,6 +7,7 @@ import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/component/tool/CustomCard.dart'; import 'package:vbvs_app/controller/setting/language/language_controller.dart'; +import 'package:vbvs_app/controller/weather/weather_controller.dart'; import 'package:vbvs_app/language/AppLanguage.dart'; import 'package:vbvs_app/pages/device_bind/componnet/FancyCircleCheckbox.dart'; @@ -132,6 +133,11 @@ class _LanguageSettingState extends State { await ef.kvdb.write( "th/language", language.language_code); + WeatherModelController + weatherModelController = + Get.find(); + weatherModelController + .getCurrentWeather(); } catch (e) { print(e); }