From 9fe66f0c0c3392f1de260ffdb7315ea16b42efc7 Mon Sep 17 00:00:00 2001 From: wyf <494641114@qq.com> Date: Fri, 11 Jul 2025 11:07:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/img/icon/question.svg | 15 + .../weather/weather_controller.dart | 190 ++++++++- lib/main.dart | 3 +- .../component/main_page_b_bottom_change.dart | 28 +- .../device/mht_blueteeth_device_page.dart | 366 ++++++++++-------- lib/pages/mh_page/homepage/new_Home_page.dart | 4 + lib/pages/mh_page/searchWidget.dart | 23 +- lib/pages/mh_page/test/WebviewTestModel.dart | 19 +- .../sleep_report/chart/DataShowWidget.dart | 4 +- .../component/HeartChangeWidget.dart | 4 +- lib/pages/xiaoe/xiaoe_page.dart | 2 +- 11 files changed, 452 insertions(+), 206 deletions(-) create mode 100644 assets/img/icon/question.svg diff --git a/assets/img/icon/question.svg b/assets/img/icon/question.svg new file mode 100644 index 0000000..5b6e120 --- /dev/null +++ b/assets/img/icon/question.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/lib/controller/weather/weather_controller.dart b/lib/controller/weather/weather_controller.dart index 53ea313..22d50a7 100644 --- a/lib/controller/weather/weather_controller.dart +++ b/lib/controller/weather/weather_controller.dart @@ -49,14 +49,19 @@ class WeatherModelController extends GetControllerEx { @override Future onInit() async { super.onInit(); - await _getCurrentLocation(); - _weatherTimer = Timer.periodic(Duration(seconds: 5), (timer) { - _getCurrentWeather(); // 每 5 秒更新一次天气 - }); - _locationTimer = Timer.periodic(Duration(minutes: 10), (timer) { - _getCurrentLocation(); // 每 10 分钟更新一次位置 - }); + try { + await _getCurrentLocation(); + _weatherTimer = Timer.periodic(Duration(seconds: 5), (timer) { + _getCurrentWeather(); // 每 5 秒更新一次天气 + }); + + _locationTimer = Timer.periodic(Duration(minutes: 10), (timer) { + _getCurrentLocation(); // 每 10 分钟更新一次位置 + }); + } catch (e) { + ef.log("[天气和定位请求失败]"); + } } @override @@ -122,7 +127,13 @@ class WeatherModelController extends GetControllerEx { return Future.error('位置权限被永久拒绝'); } - return await Geolocator.getCurrentPosition(); + return await Geolocator.getCurrentPosition( + locationSettings: const LocationSettings( + accuracy: LocationAccuracy.low, // 使用高精度定位,但不依赖 Google Play + distanceFilter: 1000, // 设置最小距离过滤 + timeLimit: Duration(seconds: 10), // 设置获取位置的最大等待时间 + ), + ); } // 获取天气信息 @@ -186,3 +197,166 @@ class WeatherModelController extends GetControllerEx { } } } + +// import 'dart:async'; +// import 'package:EasyDartModule/EasyDartModule.dart'; +// import 'package:ef/ef.dart'; +// import 'package:amap_flutter_location/amap_flutter_location.dart'; // 导入 amap_flutter_location 插件 +// import 'package:geocoding/geocoding.dart'; +// import 'package:json_annotation/json_annotation.dart'; +// import 'package:vbvs_app/common/util/CommonVariables.dart'; +// import 'package:vbvs_app/controller/setting/language/language_controller.dart'; +// import 'package:weather/weather.dart'; + +// part 'weather_controller.g.dart'; + +// @JsonSerializable() +// class WeatherModel { +// double? longitude; // 经度 +// double? latitude; // 纬度 +// String? weather_info = ''; // 天气 +// int? current_temperature; // 温度 +// int? min_temperature; // 最低温度 +// int? max_temperature; // 最高温度 +// String? wind_direction; // 风向 +// int? wind_speed; // 风速等级 +// String? cityName; // 城市名 +// String? weatherIcon; // 天气图标 +// String? weatherIconurl; // 天气图标url + +// WeatherModel(); + +// static WeatherModel fromJson(Map json) => +// _$WeatherModelFromJson(json); + +// Map toJson() => _$WeatherModelToJson(this); +// } + +// class WeatherModelController extends GetControllerEx { +// LanguageController languageController = Get.find(); +// WeatherModelController() { +// attr = GetModel(WeatherModel()).obs; +// weatherFactory = WeatherFactory(CommonVariables.weather_apiKey, +// language: Language.CHINESE_SIMPLIFIED); +// } + +// Timer? _weatherTimer; +// Timer? _locationTimer; + +// late WeatherFactory weatherFactory; +// late AMapFlutterLocation location; // 声明 AMapFlutterLocation 实例 + +// @override +// Future onInit() async { +// super.onInit(); + +// location = AMapFlutterLocation(); // 初始化 AMapFlutterLocation + +// try { +// await _getCurrentLocation(); +// _weatherTimer = Timer.periodic(Duration(seconds: 5), (timer) { +// _getCurrentWeather(); // 每 5 秒更新一次天气 +// }); + +// _locationTimer = Timer.periodic(Duration(minutes: 10), (timer) { +// _getCurrentLocation(); // 每 10 分钟更新一次位置 +// }); +// } catch (e) { +// ef.log("[天气和定位请求失败]"); +// } +// } + +// @override +// void onClose() { +// _weatherTimer?.cancel(); // 取消天气更新定时器 +// _locationTimer?.cancel(); // 取消位置更新定时器 +// location.stopLocation(); // 停止高德定位 +// super.onClose(); +// } + +// // 获取当前位置并存储到 model +// Future _getCurrentLocation() async { +// try { +// // 开始定位 +// location.startLocation(); + +// // 监听定位回调 + +// location.onLocationChanged().listen((Map result) { +// ///result即为定位结果 +// ef.log("[位置]:${result}"); +// }); + +// // location.onLocationChanged.listen((locationData) { +// // if (locationData.latitude != null && locationData.longitude != null) { +// // model.latitude = locationData.latitude; +// // model.longitude = locationData.longitude; + +// // // 获取位置对应的城市名 +// // _getCityName(locationData.latitude!, locationData.longitude!); +// // } +// // }); +// } catch (e) { +// print(e); +// EasyDartModule.logger.error("获取位置失败: $e"); +// } +// } + +// // 获取城市名 +// Future _getCityName(double latitude, double longitude) async { +// try { +// List placemarks = +// await placemarkFromCoordinates(latitude, longitude); + +// if (placemarks.isNotEmpty) { +// model.cityName = placemarks[0].locality ?? "未知数据".tr; +// } +// // 获取天气 +// _getCurrentWeather(); +// } catch (e) { +// print(e); +// EasyDartModule.logger.error("获取城市名失败: $e"); +// } +// } + +// // 获取天气信息 +// Future _getCurrentWeather() async { +// if (model.latitude == null || model.longitude == null) { +// EasyDartModule.logger.error("获取天气失败:位置数据获取失败"); +// return; // 如果位置数据没有获取到,则不更新天气 +// } + +// try { +// weatherFactory.language = Language.CHINESE_SIMPLIFIED; +// Weather weather = await weatherFactory.currentWeatherByLocation( +// model.latitude!, model.longitude!); + +// model.weather_info = weather.weatherDescription; +// model.min_temperature = weather.tempMin?.celsius?.toInt(); +// model.max_temperature = weather.tempMax?.celsius?.toInt(); +// model.current_temperature = weather.temperature?.celsius?.toInt(); +// model.wind_speed = weather.windSpeed?.toInt(); +// model.weatherIcon = weather.weatherIcon; +// if (model.weatherIcon != null) { +// model.weatherIconurl = +// "https://openweathermap.org/img/w/${model.weatherIcon}.png"; +// } +// updateAll(); // 更新 UI +// } catch (e) { +// EasyDartModule.logger.error("获取天气失败: $e"); +// print('获取天气失败: $e'); +// } +// } + +// // 获取 5 天天气预报 +// Future> getWeatherForecast( +// double latitude, double longitude) async { +// try { +// return await weatherFactory.fiveDayForecastByLocation( +// latitude, longitude); +// } catch (e) { +// print('获取天气预报失败: $e'); +// rethrow; +// } +// } +// } diff --git a/lib/main.dart b/lib/main.dart index 8f9ae53..e9cecc8 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -69,7 +69,6 @@ import 'package:vbvs_app/pages/mh_page/MattressControl.dart'; import 'package:vbvs_app/pages/mh_page/device/component/mht_device_calibration_controller.dart'; import 'package:vbvs_app/pages/mh_page/device/controller/mht_bluetooth_controller.dart'; import 'package:vbvs_app/pages/mh_page/homepage/controller/mht_home_controller.dart'; -import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart'; import 'package:vbvs_app/pages/mh_page/user/controller/mht_login_controller.dart'; import 'package:vbvs_app/pages/mh_page/user/controller/mht_register_controller.dart'; import 'package:vbvs_app/pages/mh_page/user/controller/update_password_controller.dart'; @@ -81,6 +80,7 @@ import 'routers/routers.dart'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); + final Locale? deviceLocale = Get.deviceLocale; print('系统语言: ${deviceLocale?.languageCode}'); @@ -369,7 +369,6 @@ class MyApp extends StatelessWidget { Get.lazyPut(() => CalendarController()), Get.lazyPut(() => UserPdfController()), Get.lazyPut(() => PrivacyPdfController()), - Get.put(WebviewTestController()), ])); } diff --git a/lib/pages/main_bottom/component/main_page_b_bottom_change.dart b/lib/pages/main_bottom/component/main_page_b_bottom_change.dart index 398ebc1..31a9169 100644 --- a/lib/pages/main_bottom/component/main_page_b_bottom_change.dart +++ b/lib/pages/main_bottom/component/main_page_b_bottom_change.dart @@ -1,12 +1,17 @@ +import 'dart:convert'; + import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; +import 'package:vbvs_app/common/util/CommonVariables.dart'; import 'package:vbvs_app/component/NullDataComponentWidget.dart'; +import 'package:vbvs_app/model/WebSocketMessage.dart'; import 'package:vbvs_app/pages/common/bezier_bottom_navigation_bar.dart'; import 'package:vbvs_app/pages/mh_page/MattressControl.dart'; import 'package:vbvs_app/pages/mh_page/homepage/mht_sleep_report_page.dart'; import 'package:vbvs_app/pages/mh_page/homepage/new_Home_page.dart'; import 'package:vbvs_app/pages/mh_page/new_mine_page.dart'; import 'package:vbvs_app/pages/mh_page/test/WebviewTestModel.dart'; +import 'package:EasyDartModule/EasyDartModule.dart' as edm; class MainPageBBottomChange extends StatefulWidget { // 全局 key,用于静态访问 _HomePageState @@ -138,11 +143,24 @@ class _HomePageState extends State } Future dealWebSource(int index) async { - WebviewTestController webviewTestController = Get.find(); - if (index == 2) { - await webviewTestController.web.jsbridge?.dart.pageActive(true); - } else { - await webviewTestController.web.jsbridge?.dart.pageInActive(); + try { + WebviewTestController webviewTestController = Get.find(); + if (index == 2) { + await webviewTestController.web.jsbridge?.dart.pageActive(true); + //激活websocket + CommonVariables.callMap["/smartbed/connect"] = (data) { + //订阅连接消息 + ef.log("[设备申请连接]:$data"); + }; + edm.EasyDartModule.websocket.sendData(jsonEncode(WebSocketMessage( + path: "/smartbed/connect", + type: 5, + data: {"mac": webviewTestController.selectDevice['mac']}))); + } else { + await webviewTestController.web.jsbridge?.dart.pageInActive(); + } + } catch (e) { + ef.log("[激活控制页面报错]:$e"); } } } 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 1155c68..75ffa9f 100644 --- a/lib/pages/mh_page/device/mht_blueteeth_device_page.dart +++ b/lib/pages/mh_page/device/mht_blueteeth_device_page.dart @@ -17,6 +17,7 @@ import 'package:vbvs_app/pages/mh_page/component/mht_bind_dialog.dart'; import 'package:vbvs_app/pages/mh_page/device/component/DeviceComponentWidget.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/searchWidget.dart'; class MHTBlueteethDevicePage extends StatefulWidget { var deviceType; @@ -146,7 +147,8 @@ class _MHTBlueteethDevicePageState extends State { final filteredResults = results.where((r) { final localName = r.advertisementData.localName; final isTarget = r.rssi > signalThreshold && - isTargetDevice(localName, widget.deviceType['reg'].cast()); + isTargetDevice( + localName, widget.deviceType['reg'].cast()); if (!isTarget) return false; final name = r.advertisementData.advName.toLowerCase(); String macAddress = r.device.remoteId.str; @@ -336,8 +338,8 @@ class _MHTBlueteethDevicePageState extends State { decoration: BoxDecoration( gradient: LinearGradient( colors: [ - stringToColor("FCFCFC"), - stringToColor("CEECE3") + stringToColor("#003058").withOpacity(0.8), + stringToColor("#003058").withOpacity(0.8), ], begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -360,7 +362,7 @@ class _MHTBlueteethDevicePageState extends State { : '扫描中'.tr, style: TextStyle( fontFamily: 'Inter', - color: stringToColor("#003058"), + color: stringToColor("#FFFFFF"), fontSize: 26.rpx, letterSpacing: 0.0, ), @@ -375,8 +377,10 @@ class _MHTBlueteethDevicePageState extends State { decoration: BoxDecoration( gradient: LinearGradient( colors: [ - stringToColor("FCFCFC"), - stringToColor("CEECE3") + // stringToColor("FCFCFC"), + // stringToColor("CEECE3") + Colors.transparent, + Colors.transparent, ], begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -393,7 +397,7 @@ class _MHTBlueteethDevicePageState extends State { '最小信号强度'.tr, style: TextStyle( fontFamily: 'Inter', - color: stringToColor("#003058"), + color: stringToColor("#FFFFFF"), fontSize: 26.rpx, letterSpacing: 0.0, ), @@ -423,7 +427,7 @@ class _MHTBlueteethDevicePageState extends State { '${mhtBlueToothController.model.singal!.toInt()}', style: TextStyle( fontFamily: 'Inter', - color: stringToColor("#003058"), + color: stringToColor("#FFFFFF"), fontSize: 26.rpx, letterSpacing: 0.0, ), @@ -433,164 +437,194 @@ class _MHTBlueteethDevicePageState extends State { ), ), ), - Container( - width: double.infinity, - decoration: BoxDecoration( - color: themeController.currentColor.sc3, - borderRadius: BorderRadius.circular(20.rpx), - ), - child: Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 35.rpx, 0, 35.rpx, 0), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 0, 0.rpx, 0, 0), - child: Container( - width: 25.rpx, - height: 25.rpx, - decoration: BoxDecoration(), - child: SvgPicture.asset( - 'assets/img/icon/query.svg', - fit: BoxFit.cover, - color: stringToColor("#333333"), - ), - ), - ), - Expanded( - child: Container( - width: 100.rpx, - height: 90.rpx, - decoration: BoxDecoration( - color: Colors.white, - ), - child: Align( - alignment: - AlignmentDirectional(-1, 0), - child: TextFormField( - initialValue: - mhtBlueToothController - .search.value, - onChanged: (Value) { - mhtBlueToothController - .search.value = Value; - }, - autofocus: false, - obscureText: false, - decoration: InputDecoration( - isDense: true, - labelStyle: TextStyle( - fontFamily: 'Inter', - fontSize: 26.rpx, - letterSpacing: 0.0, - ), - hintText: '检索设备'.tr, - hintStyle: TextStyle( - fontFamily: 'Inter', - fontSize: 26.rpx, - letterSpacing: 0.0, - ), - enabledBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: Color(0x00000000), - width: 1.rpx, - ), - borderRadius: - BorderRadius.circular( - 8.rpx), - ), - focusedBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: Color(0x00000000), - width: 1.rpx, - ), - borderRadius: - BorderRadius.circular( - 8.rpx), - ), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.red, - width: 1.rpx, - ), - borderRadius: - BorderRadius.circular( - 8.rpx), - ), - focusedErrorBorder: - OutlineInputBorder( - borderSide: BorderSide( - color: Colors.red, - width: 1.rpx, - ), - borderRadius: - BorderRadius.circular( - 8.rpx), - ), - filled: false, - fillColor: themeController - .currentColor.sc22, - ), - style: TextStyle( - fontFamily: 'Inter', - fontSize: 26.rpx, - letterSpacing: 0.0, - ), - cursorColor: - stringToColor("#003058"), - ), - ), - ), - ), - ].divide(SizedBox(width: 6.rpx)), - ), - ), - Padding( - padding: EdgeInsetsDirectional.fromSTEB( - 26.rpx, 0, 0, 0), - child: Row( - mainAxisSize: MainAxisSize.max, - children: [ - SizedBox( - height: 50.rpx, - child: VerticalDivider( - thickness: 2.rpx, - color: stringToColor("#333333"), - ), - ), - ClickableContainer( - backgroundColor: Colors.transparent, - highlightColor: - themeController.currentColor.sc4, - borderRadius: 6.rpx, - padding: EdgeInsets.zero, - onTap: () async { - _startScanning(); - }, - child: Text( - '搜索'.tr, - style: TextStyle( - fontFamily: 'Inter', - fontSize: 30.rpx, - letterSpacing: 0.0, - color: stringToColor("#333333"), - ), - ), - ), - ].divide(SizedBox(width: 26.rpx)), - ), - ), - ], - ), + // Container( + // width: double.infinity, + // decoration: BoxDecoration( + // color: themeController.currentColor.sc3, + // borderRadius: BorderRadius.circular(20.rpx), + // ), + // // child: Padding( + // // padding: EdgeInsetsDirectional.fromSTEB( + // // 35.rpx, 0, 35.rpx, 0), + // // child: Row( + // // mainAxisSize: MainAxisSize.max, + // // mainAxisAlignment: MainAxisAlignment.spaceBetween, + // // children: [ + // // Expanded( + // // child: Row( + // // mainAxisSize: MainAxisSize.max, + // // children: [ + // // Padding( + // // padding: EdgeInsetsDirectional.fromSTEB( + // // 0, 0.rpx, 0, 0), + // // child: Container( + // // width: 25.rpx, + // // height: 25.rpx, + // // decoration: BoxDecoration(), + // // child: SvgPicture.asset( + // // 'assets/img/icon/query.svg', + // // fit: BoxFit.cover, + // // color: stringToColor("#333333"), + // // ), + // // ), + // // ), + // // Expanded( + // // child: Container( + // // width: 100.rpx, + // // height: 90.rpx, + // // decoration: BoxDecoration( + // // color: Colors.white, + // // ), + // // child: Align( + // // alignment: + // // AlignmentDirectional(-1, 0), + // // child: TextFormField( + // // initialValue: + // // mhtBlueToothController + // // .search.value, + // // onChanged: (Value) { + // // mhtBlueToothController + // // .search.value = Value; + // // }, + // // autofocus: false, + // // obscureText: false, + // // decoration: InputDecoration( + // // isDense: true, + // // labelStyle: TextStyle( + // // fontFamily: 'Inter', + // // fontSize: 26.rpx, + // // letterSpacing: 0.0, + // // ), + // // hintText: '检索设备'.tr, + // // hintStyle: TextStyle( + // // fontFamily: 'Inter', + // // fontSize: 26.rpx, + // // letterSpacing: 0.0, + // // ), + // // enabledBorder: + // // OutlineInputBorder( + // // borderSide: BorderSide( + // // color: Color(0x00000000), + // // width: 1.rpx, + // // ), + // // borderRadius: + // // BorderRadius.circular( + // // 8.rpx), + // // ), + // // focusedBorder: + // // OutlineInputBorder( + // // borderSide: BorderSide( + // // color: Color(0x00000000), + // // width: 1.rpx, + // // ), + // // borderRadius: + // // BorderRadius.circular( + // // 8.rpx), + // // ), + // // errorBorder: OutlineInputBorder( + // // borderSide: BorderSide( + // // color: Colors.red, + // // width: 1.rpx, + // // ), + // // borderRadius: + // // BorderRadius.circular( + // // 8.rpx), + // // ), + // // focusedErrorBorder: + // // OutlineInputBorder( + // // borderSide: BorderSide( + // // color: Colors.red, + // // width: 1.rpx, + // // ), + // // borderRadius: + // // BorderRadius.circular( + // // 8.rpx), + // // ), + // // filled: false, + // // fillColor: themeController + // // .currentColor.sc22, + // // ), + // // style: TextStyle( + // // fontFamily: 'Inter', + // // fontSize: 26.rpx, + // // letterSpacing: 0.0, + // // ), + // // cursorColor: + // // stringToColor("#003058"), + // // ), + // // ), + // // ), + // // ), + // // ].divide(SizedBox(width: 6.rpx)), + // // ), + // // ), + // // Padding( + // // padding: EdgeInsetsDirectional.fromSTEB( + // // 26.rpx, 0, 0, 0), + // // child: Row( + // // mainAxisSize: MainAxisSize.max, + // // children: [ + // // SizedBox( + // // height: 50.rpx, + // // child: VerticalDivider( + // // thickness: 2.rpx, + // // color: stringToColor("#333333"), + // // ), + // // ), + // // ClickableContainer( + // // backgroundColor: Colors.transparent, + // // highlightColor: + // // themeController.currentColor.sc4, + // // borderRadius: 6.rpx, + // // padding: EdgeInsets.zero, + // // onTap: () async { + // // _startScanning(); + // // }, + // // child: Text( + // // '搜索'.tr, + // // style: TextStyle( + // // fontFamily: 'Inter', + // // fontSize: 30.rpx, + // // letterSpacing: 0.0, + // // color: stringToColor("#333333"), + // // ), + // // ), + // // ), + // // ].divide(SizedBox(width: 26.rpx)), + // // ), + // // ), + // // ], + // // ), + // // ), + // child: Padding( + // padding: + // EdgeInsetsDirectional.fromSTEB(0, 10, 0, 23), + // child: SearchWidget( + // keyword: mhtBlueToothController.search.value, + // color: Colors.red, + // hint: "检索设备", + // onChange: (d) { + // mhtBlueToothController.search.value = d; + // }, + // findCallback: () { + // // controller.getDeviceList(); + // }, + // ), + // ), + // ), + Padding( + padding: EdgeInsetsDirectional.fromSTEB(0, 0, 0, 0), + child: SearchWidget( + padding: EdgeInsets.all(0), + keyword: mhtBlueToothController.search.value, + color: Colors.red, + hint: "检索设备", + onChange: (d) { + mhtBlueToothController.search.value = d; + }, + findCallback: () { + _startScanning(); + }, ), ), Padding( diff --git a/lib/pages/mh_page/homepage/new_Home_page.dart b/lib/pages/mh_page/homepage/new_Home_page.dart index c04c77f..1541314 100644 --- a/lib/pages/mh_page/homepage/new_Home_page.dart +++ b/lib/pages/mh_page/homepage/new_Home_page.dart @@ -574,6 +574,8 @@ class _NewHomePageState extends State { 'date': DateTime .now() .millisecondsSinceEpoch, + 'person_show': + false, }, ); } @@ -665,6 +667,8 @@ class _NewHomePageState extends State { 'date': timeMillis, // 'backgroundColor':stringToColor("#003058"), + 'person_show': + false, }, ); }, diff --git a/lib/pages/mh_page/searchWidget.dart b/lib/pages/mh_page/searchWidget.dart index ad7e729..c71ab6a 100644 --- a/lib/pages/mh_page/searchWidget.dart +++ b/lib/pages/mh_page/searchWidget.dart @@ -11,18 +11,21 @@ class SearchWidget extends GetView { String? hint; Function? onChange; Function? findCallback; + final EdgeInsetsGeometry? padding; // 新增 padding 参数 - SearchWidget( - {required this.keyword, - required this.color, - this.hint = "请输入关键字", - this.findCallback, - this.onChange}); + SearchWidget({ + required this.keyword, + required this.color, + this.hint = "请输入关键字", + this.findCallback, + this.onChange, + this.padding, // 传入 padding 参数 + }); @override Widget build(BuildContext context) { return Padding( - padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0), + padding: padding ?? EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0), // 使用传入的 padding 或默认值 child: Container( width: double.infinity, decoration: BoxDecoration( @@ -42,7 +45,6 @@ class SearchWidget extends GetView { Container( width: 25.rpx, height: 25.rpx, - // width: double.infinity, decoration: BoxDecoration(), child: SvgPicture.asset( 'assets/img/icon/query.svg', @@ -112,11 +114,6 @@ class SearchWidget extends GetView { color: Colors.black, letterSpacing: 0.0, ), - // cursorColor: - // FlutterFlowTheme.of(context).primaryText, - // validator: _model - // .textControllerValidator - // .asValidator(context), onChanged: (d) { onChange?.call(d); }, diff --git a/lib/pages/mh_page/test/WebviewTestModel.dart b/lib/pages/mh_page/test/WebviewTestModel.dart index aaa1737..1de75b0 100644 --- a/lib/pages/mh_page/test/WebviewTestModel.dart +++ b/lib/pages/mh_page/test/WebviewTestModel.dart @@ -278,13 +278,18 @@ class WebviewTestController extends GetControllerEx { class WebviewTestView extends GetComponent { WebviewTestView({super.key, super.oncreate}); - // @override - // WebviewTestController newinstance() { - // if (ef.kvRoot.WebviewTestController == null) { - // ef.kvRoot.WebviewTestController = WebviewTestController(); - // } - // return ef.kvRoot.WebviewTestController; - // } + @override + WebviewTestController newinstance() { + if (ef.kvRoot.WebviewTestController == null) { + ef.kvRoot.WebviewTestController = WebviewTestController(); + if (Get.isRegistered() == false) { + Get.put(ef.kvRoot.WebviewTestController); + WebviewTestController webviewTestController = Get.find(); + return webviewTestController; + } + } + return ef.kvRoot.WebviewTestController; + } @override Widget build(BuildContext context) { diff --git a/lib/pages/sleep_report/chart/DataShowWidget.dart b/lib/pages/sleep_report/chart/DataShowWidget.dart index c022d07..7b2349c 100644 --- a/lib/pages/sleep_report/chart/DataShowWidget.dart +++ b/lib/pages/sleep_report/chart/DataShowWidget.dart @@ -76,7 +76,7 @@ class _DataShowWidgetState extends State { ), // 放入传入的 widget3 Container( - width: MediaQuery.sizeOf(context).width * 0.2, // 固定宽度 + width: MediaQuery.sizeOf(context).width * 0.25, // 固定宽度 decoration: BoxDecoration(), child: Align( alignment: widget.alignment == MainAxisAlignment.start @@ -89,7 +89,7 @@ class _DataShowWidgetState extends State { ), // 放入传入的 widget4 Container( - width: MediaQuery.sizeOf(context).width * 0.15, // 固定宽度 + width: MediaQuery.sizeOf(context).width * 0.1, // 固定宽度 decoration: BoxDecoration(), child: Align( alignment: widget.alignment == MainAxisAlignment.start diff --git a/lib/pages/sleep_report/component/HeartChangeWidget.dart b/lib/pages/sleep_report/component/HeartChangeWidget.dart index 13aa542..d36c9a6 100644 --- a/lib/pages/sleep_report/component/HeartChangeWidget.dart +++ b/lib/pages/sleep_report/component/HeartChangeWidget.dart @@ -148,7 +148,7 @@ class _HeartChangeWidgetState extends State { alignment: MainAxisAlignment.center, widget1: Row( children: [ - Expanded( + Flexible( child: Text( '${data['name']}', maxLines: 1, @@ -186,7 +186,7 @@ class _HeartChangeWidgetState extends State { width: 17.rpx, height: 17.rpx, child: SvgPicture.asset( - 'assets/img/icon/explain.svg', + 'assets/img/icon/question.svg', fit: BoxFit.cover, color: Colors.white, ), diff --git a/lib/pages/xiaoe/xiaoe_page.dart b/lib/pages/xiaoe/xiaoe_page.dart index bc94604..4574c0c 100644 --- a/lib/pages/xiaoe/xiaoe_page.dart +++ b/lib/pages/xiaoe/xiaoe_page.dart @@ -65,7 +65,7 @@ class _XiaoEPageState extends State { children: [ /// 居中标题 Text( - '健康报告'.tr, + '小e'.tr, style: TextStyle( fontFamily: 'Readex Pro', color: themeController.currentColor.sc3,