From 98cd7f4e6a07285bcadad7d00be5b9fdf8512b1b Mon Sep 17 00:00:00 2001
From: wyf <494641114@qq.com>
Date: Tue, 27 May 2025 23:09:31 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=9D=A1=E7=9C=A0=E6=8A=A5?=
=?UTF-8?q?=E5=91=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
assets/img/icon/calendar.svg | 1 +
assets/img/moon.png | Bin 0 -> 1979 bytes
assets/img/sun.png | Bin 0 -> 1919 bytes
assets/langs/zh_CN.json | 30 +-
lib/common/color/ServiceConstant.dart | 2 +
lib/common/util/MyUtils.dart | 21 +
lib/component/base/GradientSwitch.dart | 90 ++
.../home_page/DynamicReportDetailWidget.dart | 18 +-
.../home_page/SleepDataModuleWidget.dart | 91 +-
.../device/blueteeth_bind_controller.dart | 2 +-
.../common_message_setting_controller.dart | 38 +
.../common_message_setting_controller.g.dart | 28 +
.../message/message_setting_controller.dart | 34 +
.../message/message_setting_controller.g.dart | 21 +
.../sleep/sleep_report_controller.dart | 1 +
lib/main.dart | 4 +
.../component/DeviceDataComponentWidget.dart | 3 +-
.../device/component/MessageSetting.dart | 574 +++++++++
.../component/ReviewMessageWidgetWidget.dart | 2 +-
lib/pages/device/message_review_page.dart | 87 +-
.../SingleBlueteethDeviceCompoentWidget.dart | 11 +-
lib/pages/device_bind/device_calibration.dart | 10 +-
lib/pages/device_bind/device_share_page.dart | 99 +-
lib/pages/login/login.dart | 31 +-
lib/pages/login/other_login.dart | 133 ++-
lib/pages/main_bottom/mine_page.dart | 6 +-
lib/pages/setting/common_mesaage_setting.dart | 896 ++++++++++++++
.../sleep_report/chart/DataShowWidget.dart | 2 +-
lib/pages/sleep_report/chart/DotBarChart.dart | 173 ++-
.../sleep_report/chart/GradientLine.dart | 48 +
.../chart/SegmentedCirclePainter.dart | 24 +-
.../sleep_report/chart/SleepRadarChart.dart | 131 +--
.../sleep_report/chart/SnoreWaveform.dart | 273 +++++
.../component/AIAdviceWidget.dart | 39 +-
.../component/BreathPauseWidget.dart | 59 +-
.../sleep_report/component/BreatheCard.dart | 69 ++
.../component/BreathePauseNewWidget.dart | 166 +++
.../component/BreatheStandardWidget.dart | 37 +-
.../component/CompareSleepWidget.dart | 55 +-
.../component/DiseasePercentsWidget.dart | 120 +-
.../component/HeartChangeWidget.dart | 155 +--
.../component/HeartHealthWidget.dart | 62 +-
.../component/HeartPointWidget.dart | 49 +-
.../sleep_report/component/HeartRateCard.dart | 69 ++
.../component/HeartRateStandardWidget.dart | 30 +-
.../component/SkinPercentWidget.dart | 41 +-
.../sleep_report/component/SleepCard.dart | 69 ++
.../component/SleepScoreWidget.dart | 105 +-
.../sleep_report/component/SleepView.dart | 388 ++++++
.../component/SnoreViewWidget.dart | 66 +-
.../component/ZiZhuShenJingPercentWidget.dart | 38 +-
.../sleep_report/new_sleep_report_page.dart | 1041 +++++++++--------
lib/pages/user/setting_page.dart | 51 +
lib/routers/routers.dart | 17 +-
54 files changed, 4450 insertions(+), 1160 deletions(-)
create mode 100644 assets/img/icon/calendar.svg
create mode 100644 assets/img/moon.png
create mode 100644 assets/img/sun.png
create mode 100644 lib/component/base/GradientSwitch.dart
create mode 100644 lib/controller/message/common_message_setting_controller.dart
create mode 100644 lib/controller/message/common_message_setting_controller.g.dart
create mode 100644 lib/controller/message/message_setting_controller.dart
create mode 100644 lib/controller/message/message_setting_controller.g.dart
create mode 100644 lib/pages/device/component/MessageSetting.dart
create mode 100644 lib/pages/setting/common_mesaage_setting.dart
create mode 100644 lib/pages/sleep_report/chart/GradientLine.dart
create mode 100644 lib/pages/sleep_report/chart/SnoreWaveform.dart
create mode 100644 lib/pages/sleep_report/component/BreatheCard.dart
create mode 100644 lib/pages/sleep_report/component/BreathePauseNewWidget.dart
create mode 100644 lib/pages/sleep_report/component/HeartRateCard.dart
create mode 100644 lib/pages/sleep_report/component/SleepCard.dart
create mode 100644 lib/pages/sleep_report/component/SleepView.dart
diff --git a/assets/img/icon/calendar.svg b/assets/img/icon/calendar.svg
new file mode 100644
index 0000000..74d3b59
--- /dev/null
+++ b/assets/img/icon/calendar.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/assets/img/moon.png b/assets/img/moon.png
new file mode 100644
index 0000000000000000000000000000000000000000..7a1b2146c174bf78cd94baf094ddeb303174dbc8
GIT binary patch
literal 1979
zcmX|A3s4hh5I#glph8a&hls&gwHTFpC@RL8_CO*;G)6#2c^=5i5a~&vT3c&;L9J9H
z4@C%gf)E7JAmw2}IUcPNd>rBf%2*>7FvWIGrLD9Hb}#8Pv$xsXfA`yOzdt!9lLk6E
z%yK{w#8DCy5CY$U++$}8J}$M&3qd9|%Ql3G1IZ0hg(k2Vjd=%Ujz4dXE#WNgoS7
zCznq^1}vp=0u1s=7bX;yoWT*)q-ZB13r&Qj1p+Gq_=Hk(@`VZT&;>0}nOMg4S~Kt}
zub7A~GC{y)v>Y-_i7Dphf&moZ0}l9|U=`dHYZ(MqdR7`h8v@7x+a2f4zy!L$xS^H+
zU?Bh-Hia8=>8*JeHmWoMCVRC21Xn88Dia;h4aHVk%sX3osH>8Po*BP#A-&bt;0w)g+@*1Y
zFA4Aq+jg}4Ou`o~elyl-)hq42W(Z~9xYkfd8)Pj_&HsOL)$uvbDcKD{&yv{N@xAqD
zUDH1KU2#`Ad|g@BtlHXG_@ujKAn*H2y3?
zJ8C;!7A7V2DP|Wt53VVlBAOYz^wq}Wqs@CYHwGgU9C@b9Tu(Sn
zdEUP?JZQ{5BfG;`(BzXneNOSpk58Sbo#mQan3?g@C(}QQd^5gRI4?Wv8%a=m)Jgf=
z@P0AF6Az`o=i%|{>(k@iq;J{KHUExur;>!t)yTq87wyZ7er;p+B}0FP*EGb5uivos
z%j$T=_}WMH_2|31y1M$MJ+UE~H@h@#FO!F2rIc@7&PK+2pJ2YS%48UwJSngsf6XPQ
zqzLrxT;=2e2VdT~JqIMhwRWq})wc524X$^#-1QUw(@>s_otQxHQ%H$G-h#?&rHd
zJqA@-n|<>Z1xtDDleQEz`0%%3AC!Im?!ivt=DS*SdLSKJTkM^rochIr$)@O(;nf
z4K_U~da&D0IFH}hT;m7vMP$nCt!mH>T089KIs>PW+ePxdQPeFJPfgBK-SI2`@U{h`%Y=7%Qw#x$oS
zw{AK+^2c!C4BLA{8LWF>2LIUAxILF2kKVa=Wist<%
zKHg!9E&Xe_KJ@4H{g2r{oq|Lr5wjL#jaUU-BE=af`s
zA6hj0+1fPyZ_!6SZp?c$I+k^4*M5^p>~-W~Q(#TRsvA6aclUSCT>c6UlOd`DFJy`r
TWZT7c@RvsbWQ%4F>{*b%+Qxf^ZswAO79hk@7X+u!HMOH}21#lQMS(zW&<-p#
z@qq-WP()2UxJMK<=+tmVqkwz)ED0%xpj3XK7VL}$;tyg#Qu?zr_}UqdcE!ggFpLCA
zVkC|;DYk(y60`!RF`B6`k~EED7-nSBIFleTN-BygHZlb8Vt
z5t5Q5CB+Q{MPh6=W}%c89K#9Pptn#Ya6%6@n;?}InrXq5G+|`xNuz$x3UN_-14SEgj4&wJ3O21In0mHBL9?ZV(nuL;AXOTnGp463dMT;YA0%F!
z25S=(QOP?Qj46TW9Vd?G&xC<`eajqyixn9sPnPTmL##+J%5nIP442SrT8}99e>z9E3orW`GDzn
z{qv)Pp-4>abJ;SIg_Df3dn;Fo)DT?iS$U*6lDubUN2Bo3cQQJs=AZJs>~BdZHEn=ZUmXXCbalP4aZ
zQ>5*EXpsA@9di5DC99>o-b40!gSxj_XnwmWgR34mSe5Cb@?Tssk}7&U|HOgDipyKg
zO`_b~RO_i_RsMbF1a0eYsz3Z`>J&{CilXLr%#|c&t}86Ob@(a=6!zO{md!Z4o1SBJp+3zsbo!$i|Vdd
zWUh<+g+j(4e4I_W~cR47eYEGids|rK>cdIiWrkgQ52yzZsg}-@iLk(;BujpqG{vNFnyg#sd#LbO#=g|zu=SbJW7w)&&f>BGn?!r@x^G(NFIDSwcT1JHSDfHO
zLFRhzN6A@bADC&cy7 diffHoursMinutesMap(int startMillis, int endMillis) {
+ final duration = Duration(milliseconds: endMillis - startMillis);
+ final hours = duration.inHours;
+ final minutes = duration.inMinutes % 60;
+ return {
+ "hours": hours,
+ "minutes": minutes,
+ };
+ }
+
+ static String formatToHHmm(int timestampMillis) {
+ final dateTime = DateTime.fromMillisecondsSinceEpoch(timestampMillis);
+ final twoDigits = (int n) => n.toString().padLeft(2, '0');
+ return '${twoDigits(dateTime.hour)}:${twoDigits(dateTime.minute)}';
+ }
+
static ApiResponse formatResponse(
ApiResponse res,
String successMsg,
diff --git a/lib/component/base/GradientSwitch.dart b/lib/component/base/GradientSwitch.dart
new file mode 100644
index 0000000..40b8f69
--- /dev/null
+++ b/lib/component/base/GradientSwitch.dart
@@ -0,0 +1,90 @@
+import 'package:flutter/material.dart';
+
+class GradientSwitch extends StatefulWidget {
+ final bool value;
+ final ValueChanged onChanged;
+ final Gradient activeGradient;
+ final Color inactiveColor;
+ final Color activeThumbColor;
+ final Color inactiveThumbColor;
+
+ const GradientSwitch({
+ super.key,
+ required this.value,
+ required this.onChanged,
+ required this.activeGradient,
+ this.inactiveColor = Colors.grey,
+ this.activeThumbColor = Colors.white,
+ this.inactiveThumbColor = Colors.white,
+ });
+
+ @override
+ State createState() => _GradientSwitchState();
+}
+
+class _GradientSwitchState extends State
+ with SingleTickerProviderStateMixin {
+ late AnimationController _controller;
+
+ @override
+ void initState() {
+ super.initState();
+ _controller = AnimationController(
+ vsync: this, duration: const Duration(milliseconds: 200));
+ _controller.value = widget.value ? 1.0 : 0.0;
+ }
+
+ @override
+ void didUpdateWidget(covariant GradientSwitch oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (widget.value != oldWidget.value) {
+ widget.value ? _controller.forward() : _controller.reverse();
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return GestureDetector(
+ onTap: () => widget.onChanged(!widget.value),
+ child: AnimatedBuilder(
+ animation: _controller,
+ builder: (context, child) {
+ final align = Alignment.lerp(
+ Alignment.centerLeft, Alignment.centerRight, _controller.value)!;
+
+ // 动态计算小球颜色(线性过渡)
+ final thumbColor = Color.lerp(widget.inactiveThumbColor,
+ widget.activeThumbColor, _controller.value)!;
+
+ return Container(
+ width: 60,
+ height: 30,
+ padding: const EdgeInsets.all(3),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(30),
+ gradient: widget.value ? widget.activeGradient : null,
+ color: widget.value ? null : widget.inactiveColor,
+ ),
+ child: Align(
+ alignment: align,
+ child: Container(
+ width: 24,
+ height: 24,
+ decoration: BoxDecoration(
+ color: thumbColor,
+ shape: BoxShape.circle,
+ boxShadow: const [
+ BoxShadow(
+ color: Colors.black26,
+ blurRadius: 2,
+ offset: Offset(0, 1)),
+ ],
+ ),
+ ),
+ ),
+ );
+ },
+ ),
+ );
+ }
+}
diff --git a/lib/component/home_page/DynamicReportDetailWidget.dart b/lib/component/home_page/DynamicReportDetailWidget.dart
index 2fadefe..5b00bea 100644
--- a/lib/component/home_page/DynamicReportDetailWidget.dart
+++ b/lib/component/home_page/DynamicReportDetailWidget.dart
@@ -16,6 +16,7 @@ class DynamicReportDetailWidget extends StatelessWidget {
final List sleepDataModuleWidgets;
final ThemeController themeController = Get.find();
final Map targetDevice;
+ late ScrollController _scrollController;
DynamicReportDetailWidget({
required this.sleepDateWidgets,
@@ -25,6 +26,18 @@ class DynamicReportDetailWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ _scrollController = ScrollController();
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (_scrollController.hasClients) {
+ // _scrollController.jumpTo(_scrollController.position.maxScrollExtent);
+ // 如果你希望有动画,用下面这句替代 jumpTo:
+ _scrollController.animateTo(
+ _scrollController.position.maxScrollExtent,
+ duration: Duration(milliseconds: 300),
+ curve: Curves.easeOut,
+ );
+ }
+ });
return Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 25.rpx, 0, 25.rpx),
child: Container(
@@ -40,7 +53,7 @@ class DynamicReportDetailWidget extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
- _buildHeader(context,targetDevice),
+ _buildHeader(context, targetDevice),
SizedBox(
height: 33.rpx,
),
@@ -67,7 +80,7 @@ class DynamicReportDetailWidget extends StatelessWidget {
borderRadius: 0,
padding: EdgeInsets.zero,
onTap: () async {
- await Get.toNamed("/bodyDevice",arguments: targetDevice);
+ await Get.toNamed("/bodyDevice", arguments: targetDevice);
},
child: Text(
'${targetDevice['person']?['name'] == null ? '未命名'.tr : targetDevice['person']['name']}',
@@ -132,6 +145,7 @@ class DynamicReportDetailWidget extends StatelessWidget {
width: double.infinity,
decoration: BoxDecoration(),
child: SingleChildScrollView(
+ controller: _scrollController, // ⭐️ 关键点
scrollDirection: Axis.horizontal,
child: Row(
mainAxisSize: MainAxisSize.max,
diff --git a/lib/component/home_page/SleepDataModuleWidget.dart b/lib/component/home_page/SleepDataModuleWidget.dart
index dde4a6d..934bae6 100644
--- a/lib/component/home_page/SleepDataModuleWidget.dart
+++ b/lib/component/home_page/SleepDataModuleWidget.dart
@@ -101,76 +101,51 @@ class _SleepDataModuleWidgetState extends State {
),
],
),
- // Container(
- // width: MediaQuery.sizeOf(context).width * 0.07,
- // height: MediaQuery.sizeOf(context).height * 0.014,
- // constraints: BoxConstraints(
- // minWidth: 43.rpx,
- // minHeight: 36.rpx,
- // ),
- // child: FFButtonWidget(
- // onPressed: () {
- // print('Button pressed ...');
- // },
- // // text: '${widget.data['level']}',
- // text: '${widget.data['level']}',
- // options: FFButtonOptions(
- // height: 40.rpx,
- // padding: EdgeInsets.zero,
- // // color: themeController.currentColor.sc14,
- // color: stringToColor('${widget.data['color']}'),
- // textStyle:
- // FlutterFlowTheme.of(context).titleSmall.override(
- // fontFamily: 'Inter Tight',
- // color: themeController.currentColor.sc3,
- // // color: stringToColor('${widget.data['color']}'),
- // letterSpacing: 0.0,
- // fontSize: 15.rpx,
- // ),
- // elevation: 0,
- // borderRadius: BorderRadius.circular(8.rpx),
- // ),
- // ),
- // ),
-
- ClickableContainer(
- backgroundColor: stringToColor('${widget.data['color']}'),
- highlightColor: themeController.currentColor.sc3,
- padding: EdgeInsets.symmetric(
- horizontal: 0.rpx,
- vertical: 0.rpx,
- ),
- borderRadius: 8.rpx,
- onTap: () {
- print('Button pressed ...');
- },
- child: Container(
- alignment: Alignment.center,
- constraints: BoxConstraints(
- minWidth: 43.rpx,
- minHeight: 36.rpx,
+ if (widget.data['level'] != null)
+ ClickableContainer(
+ backgroundColor: (widget.data['color'] == null ||
+ widget.data['color'].toString().isEmpty)
+ ? Colors.transparent
+ : stringToColor(widget.data['color']),
+ highlightColor: themeController.currentColor.sc3,
+ padding: EdgeInsets.symmetric(
+ horizontal: 0.rpx,
+ vertical: 0.rpx,
),
- child: Text(
- '${widget.data['level']}',
- style: FlutterFlowTheme.of(context).titleSmall.override(
- fontFamily: 'Inter Tight',
- color: themeController.currentColor.sc3,
- letterSpacing: 0.0,
- fontSize: 15.rpx,
- ),
+ borderRadius: 8.rpx,
+ onTap: () {
+ print('Button pressed ...');
+ },
+ child: Container(
+ alignment: Alignment.center,
+ constraints: BoxConstraints(
+ minWidth: 43.rpx,
+ minHeight: 36.rpx,
+ ),
+ child: Text(
+ '${widget.data['level']}',
+ style: FlutterFlowTheme.of(context).titleSmall.override(
+ fontFamily: 'Inter Tight',
+ color: themeController.currentColor.sc3,
+ letterSpacing: 0.0,
+ fontSize: 15.rpx,
+ ),
+ ),
),
),
- ),
].divide(SizedBox(width: 0.rpx)),
),
Text(
- '${widget.data['range']}',
+ "正常值".tr +
+ '${(widget.data['range'] ?? '').toString().isEmpty ? '未知数据'.tr : widget.data['range']}',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: AppConstants().small_text_fontSize,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
),
],
),
diff --git a/lib/controller/device/blueteeth_bind_controller.dart b/lib/controller/device/blueteeth_bind_controller.dart
index 67ba02c..08f3ef0 100644
--- a/lib/controller/device/blueteeth_bind_controller.dart
+++ b/lib/controller/device/blueteeth_bind_controller.dart
@@ -26,7 +26,7 @@ class BlueteethBindModel {
@JsonKey(ignore: true)
List? betDevicelist = []; //网络状态
@JsonKey(ignore: true)
- List? blelist = [];
+ List? blelist = [];//蓝牙扫描的原始数据
List bindArr = ["", "", ""];
String connectedWifiName = "";
diff --git a/lib/controller/message/common_message_setting_controller.dart b/lib/controller/message/common_message_setting_controller.dart
new file mode 100644
index 0000000..26ed352
--- /dev/null
+++ b/lib/controller/message/common_message_setting_controller.dart
@@ -0,0 +1,38 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'common_message_setting_controller.g.dart'; // 由json_serializable自动生成的部分
+
+@JsonSerializable()
+class CommonMessageSettingModel {
+ int? setting = 0;//总设置 0 关闭 1 开启
+ int? appSetting = 0;//app消息设置
+ int? serviceSetting = 0;//服务号消息
+ int? tipSetting = 0;//设备放置说明
+ int? deviceUpgradeSetting = 0;//设备升级提示
+ int? deviceIssueSetting = 0;//设备故障提示
+
+
+ CommonMessageSettingModel();
+
+ // 从JSON反序列化时的异常处理
+
+ factory CommonMessageSettingModel.fromJson(Map json) {
+ try {
+ return _$CommonMessageSettingModelFromJson(json);
+ } catch (e) {
+ // 在实际应用中,应该有更细致的异常处理策略和错误日志
+ return CommonMessageSettingModel(); // 或者返回一个带有错误信息的特定DeviceInfoModel实例
+ }
+ }
+
+ // 序列化为JSON时的异常处理
+ Map toJson() => _$CommonMessageSettingModelToJson(this);
+}
+
+class CommonMessageSettingController extends GetControllerEx {
+ CommonMessageSettingController() {
+ attr = GetModel(CommonMessageSettingModel()).obs;
+ }
+
+}
diff --git a/lib/controller/message/common_message_setting_controller.g.dart b/lib/controller/message/common_message_setting_controller.g.dart
new file mode 100644
index 0000000..6559b16
--- /dev/null
+++ b/lib/controller/message/common_message_setting_controller.g.dart
@@ -0,0 +1,28 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'common_message_setting_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+CommonMessageSettingModel _$CommonMessageSettingModelFromJson(
+ Map json) =>
+ CommonMessageSettingModel()
+ ..setting = (json['setting'] as num?)?.toInt()
+ ..appSetting = (json['appSetting'] as num?)?.toInt()
+ ..serviceSetting = (json['serviceSetting'] as num?)?.toInt()
+ ..tipSetting = (json['tipSetting'] as num?)?.toInt()
+ ..deviceUpgradeSetting = (json['deviceUpgradeSetting'] as num?)?.toInt()
+ ..deviceIssueSetting = (json['deviceIssueSetting'] as num?)?.toInt();
+
+Map _$CommonMessageSettingModelToJson(
+ CommonMessageSettingModel instance) =>
+ {
+ 'setting': instance.setting,
+ 'appSetting': instance.appSetting,
+ 'serviceSetting': instance.serviceSetting,
+ 'tipSetting': instance.tipSetting,
+ 'deviceUpgradeSetting': instance.deviceUpgradeSetting,
+ 'deviceIssueSetting': instance.deviceIssueSetting,
+ };
diff --git a/lib/controller/message/message_setting_controller.dart b/lib/controller/message/message_setting_controller.dart
new file mode 100644
index 0000000..19fa89a
--- /dev/null
+++ b/lib/controller/message/message_setting_controller.dart
@@ -0,0 +1,34 @@
+import 'package:ef/ef.dart';
+import 'package:json_annotation/json_annotation.dart';
+
+part 'message_setting_controller.g.dart'; // 由json_serializable自动生成的部分
+
+@JsonSerializable()
+class MessageSettingModel {
+ int? setting = 0;//总设置 0 关闭 1 开启
+ int? appSetting = 0;//app消息设置
+ int? serviceSetting = 0;//服务号消息
+
+ MessageSettingModel();
+
+ // 从JSON反序列化时的异常处理
+
+ factory MessageSettingModel.fromJson(Map json) {
+ try {
+ return _$MessageSettingModelFromJson(json);
+ } catch (e) {
+ // 在实际应用中,应该有更细致的异常处理策略和错误日志
+ return MessageSettingModel(); // 或者返回一个带有错误信息的特定DeviceInfoModel实例
+ }
+ }
+
+ // 序列化为JSON时的异常处理
+ Map toJson() => _$MessageSettingModelToJson(this);
+}
+
+class MessageSettingController extends GetControllerEx {
+ MessageSettingController() {
+ attr = GetModel(MessageSettingModel()).obs;
+ }
+
+}
diff --git a/lib/controller/message/message_setting_controller.g.dart b/lib/controller/message/message_setting_controller.g.dart
new file mode 100644
index 0000000..cf071b8
--- /dev/null
+++ b/lib/controller/message/message_setting_controller.g.dart
@@ -0,0 +1,21 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'message_setting_controller.dart';
+
+// **************************************************************************
+// JsonSerializableGenerator
+// **************************************************************************
+
+MessageSettingModel _$MessageSettingModelFromJson(Map json) =>
+ MessageSettingModel()
+ ..setting = (json['setting'] as num?)?.toInt()
+ ..appSetting = (json['appSetting'] as num?)?.toInt()
+ ..serviceSetting = (json['serviceSetting'] as num?)?.toInt();
+
+Map _$MessageSettingModelToJson(
+ MessageSettingModel instance) =>
+ {
+ 'setting': instance.setting,
+ 'appSetting': instance.appSetting,
+ 'serviceSetting': instance.serviceSetting,
+ };
diff --git a/lib/controller/sleep/sleep_report_controller.dart b/lib/controller/sleep/sleep_report_controller.dart
index b44bd19..150b5a6 100644
--- a/lib/controller/sleep/sleep_report_controller.dart
+++ b/lib/controller/sleep/sleep_report_controller.dart
@@ -27,6 +27,7 @@ class SleepReportModel {
class SleepReportController extends GetControllerEx {
Rx selectedDate = Rx(null);
+ RxMap sleepReport = RxMap();
SleepReportController() {
attr = GetModel(SleepReportModel()).obs;
}
diff --git a/lib/main.dart b/lib/main.dart
index a00e383..43503b0 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -27,8 +27,10 @@ import 'package:vbvs_app/controller/home/home_controller.dart';
import 'package:vbvs_app/controller/login/login_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/main_bottom/main_page_controller.dart';
+import 'package:vbvs_app/controller/message/common_message_setting_controller.dart';
import 'package:vbvs_app/controller/message/message_controller.dart';
import 'package:vbvs_app/controller/message/message_review_controller.dart';
+import 'package:vbvs_app/controller/message/message_setting_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/controller/repair/repair_controller.dart';
import 'package:vbvs_app/controller/setting/language/language_controller.dart';
@@ -247,6 +249,8 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => CalendarController()),
Get.lazyPut(() => SleepReportController()),
Get.lazyPut(() => MessageReviewController()),
+ Get.lazyPut(() => MessageSettingController()),
+ Get.lazyPut(() => CommonMessageSettingController()),
]));
});
}
diff --git a/lib/pages/device/component/DeviceDataComponentWidget.dart b/lib/pages/device/component/DeviceDataComponentWidget.dart
index b017d9c..7cab3a1 100644
--- a/lib/pages/device/component/DeviceDataComponentWidget.dart
+++ b/lib/pages/device/component/DeviceDataComponentWidget.dart
@@ -328,7 +328,8 @@ class _DeviceDataComponentWidgetState extends State {
_popupEntry?.remove();
_popupEntry = null;
// Get.toNamed("/deviceDetail", arguments: widget.device);
- TopSlideNotification.show(context, text: "待开发功能".tr);
+ Get.toNamed("/messageSettingPage", arguments: widget.device);
+ // TopSlideNotification.show(context, text: "待开发功能".tr);
},
),
]);
diff --git a/lib/pages/device/component/MessageSetting.dart b/lib/pages/device/component/MessageSetting.dart
new file mode 100644
index 0000000..e8444e8
--- /dev/null
+++ b/lib/pages/device/component/MessageSetting.dart
@@ -0,0 +1,574 @@
+import 'dart:async';
+
+import 'package:ef/ef.dart';
+import 'package:flutter/material.dart';
+import 'package:flutterflow_ui/flutterflow_ui.dart';
+import 'package:vbvs_app/common/color/ServiceConstant.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/common/util/requestWithLog.dart';
+import 'package:vbvs_app/component/base/GradientSwitch.dart';
+import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
+import 'package:vbvs_app/controller/message/common_message_setting_controller.dart';
+import 'package:vbvs_app/controller/message/message_setting_controller.dart';
+import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
+
+class MessageSettingPage extends StatefulWidget {
+ var data;
+ MessageSettingPage({super.key, required this.data});
+
+ @override
+ State createState() => _MessageSettingPageState();
+}
+
+class _MessageSettingPageState extends State {
+ final ThemeController themeController = Get.find();
+ MessageSettingController messageSettingController = Get.find();
+ CommonMessageSettingController commonMessageSettingController = Get.find();
+
+ @override
+ void initState() {
+ super.initState();
+ _fetchCommonMessageSetting();
+ _fetchDeviceMessageSetting();
+ }
+
+ Future _fetchCommonMessageSetting() async {
+ String serviceAddress = ServiceConstant.service_address;
+ String serviceName = ServiceConstant.server_service;
+ String serviceApi = ServiceConstant.user_setting;
+ String type = "user_message_setting";
+ String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
+ requestWithLog(
+ logTitle: "查询用户消息配置",
+ method: MyHttpMethod.get,
+ queryUrl: queryUrl,
+ onSuccess: (res) {
+ if (res.data == null || res.data.isEmpty) {
+ var data = {
+ "type": type,
+ "setting": 1,
+ "appSetting": 1,
+ "serviceSetting": 1,
+ "tipSetting": 1,
+ "deviceUpgradeSetting": 1,
+ "deviceIssueSetting": 1,
+ };
+ requestWithLog(
+ logTitle: "更新用户消息配置",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ requestWithLog(
+ logTitle: "查询用户消息配置",
+ method: MyHttpMethod.get,
+ queryUrl: queryUrl,
+ onSuccess: (res) {
+ if (res.data != null && res.data.isNotEmpty) {
+ var datalist = res.data;
+ commonMessageSettingController.model.setting =
+ datalist['setting'];
+ commonMessageSettingController.model.appSetting =
+ datalist['appSetting'];
+ commonMessageSettingController.model.serviceSetting =
+ datalist['serviceSetting'];
+ commonMessageSettingController.model.tipSetting =
+ datalist['tipSetting'];
+ commonMessageSettingController.model.deviceUpgradeSetting =
+ datalist['deviceUpgradeSetting'];
+ commonMessageSettingController.model.deviceIssueSetting =
+ datalist['deviceIssueSetting'];
+ commonMessageSettingController.updateAll();
+ }
+ },
+ );
+
+ //
+ },
+ );
+ } else {
+ var datalist = res.data;
+ commonMessageSettingController.model.setting = datalist['setting'];
+ commonMessageSettingController.model.appSetting =
+ datalist['appSetting'];
+ commonMessageSettingController.model.serviceSetting =
+ datalist['serviceSetting'];
+ commonMessageSettingController.model.tipSetting =
+ datalist['tipSetting'];
+ commonMessageSettingController.model.deviceUpgradeSetting =
+ datalist['deviceUpgradeSetting'];
+ commonMessageSettingController.model.deviceIssueSetting =
+ datalist['deviceIssueSetting'];
+ commonMessageSettingController.updateAll();
+ }
+ },
+ onFailure: (res) {
+ print(res);
+ },
+ );
+ }
+
+ Future _fetchDeviceMessageSetting() async {
+ String serviceAddress = ServiceConstant.service_address;
+ String serviceName = ServiceConstant.server_service;
+ String serviceApi = ServiceConstant.user_setting;
+ String mac = widget.data['mac'];
+ String type = "user_device_message_setting_$mac";
+ String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
+ requestWithLog(
+ logTitle: "查询用户消息配置",
+ method: MyHttpMethod.get,
+ queryUrl: queryUrl,
+ onSuccess: (res) {
+ if (res.data == null || res.data.isEmpty) {
+ var data = {
+ "type": type,
+ "setting": 1,
+ "appSetting": 1,
+ "serviceSetting": 1,
+ };
+ requestWithLog(
+ logTitle: "更新用户消息配置",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ requestWithLog(
+ logTitle: "查询用户消息配置",
+ method: MyHttpMethod.get,
+ queryUrl: queryUrl,
+ onSuccess: (res) {
+ if (res.data != null && res.data.isNotEmpty) {
+ var datalist = res.data;
+ messageSettingController.model.setting =
+ datalist['setting'];
+ messageSettingController.model.appSetting =
+ datalist['appSetting'];
+ messageSettingController.model.serviceSetting =
+ datalist['serviceSetting'];
+ messageSettingController.updateAll();
+ }
+ },
+ );
+
+ //
+ },
+ );
+ } else {
+ var datalist = res.data;
+ messageSettingController.model.setting = datalist['setting'];
+ messageSettingController.model.appSetting = datalist['appSetting'];
+ messageSettingController.model.serviceSetting =
+ datalist['serviceSetting'];
+ messageSettingController.updateAll();
+ }
+ },
+ onFailure: (res) {
+ print(res);
+ },
+ );
+ }
+
+ @override
+ void dispose() {
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return LayoutBuilder(
+ builder: (context, bodysize) => GestureDetector(
+ onTap: () => FocusScope.of(context).unfocus(),
+ child: Container(
+ decoration: BoxDecoration(
+ image: DecorationImage(
+ image: AssetImage('assets/img/bgNoImg.png'),
+ fit: BoxFit.fill,
+ ),
+ ),
+ child: Scaffold(
+ backgroundColor: Colors.transparent,
+ appBar: AppBar(
+ backgroundColor: themeController.currentColor.sc17,
+ automaticallyImplyLeading: false,
+ iconTheme: IconThemeData(
+ color: themeController.currentColor.sc3,
+ ),
+ titleSpacing: 0,
+ title: Container(
+ width: double.infinity,
+ height: 180.rpx,
+ child: Stack(
+ alignment: Alignment.center,
+ children: [
+ /// 居中标题
+ Text(
+ '消息设置'.tr,
+ style: TextStyle(
+ fontFamily: 'ReadexPro',
+ color: themeController.currentColor.sc3,
+ letterSpacing: 0,
+ fontSize: 30.rpx,
+ ),
+ ),
+ Positioned(
+ left: 0,
+ child: returnIconButtomAddCallback(() {}),
+ ),
+ ],
+ ),
+ ),
+ actions: [],
+ centerTitle: false,
+ ),
+ body: GestureDetector(
+ child: SafeArea(
+ top: true,
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 0, 0.rpx, 0),
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Padding(
+ padding:
+ EdgeInsetsDirectional.fromSTEB(0, 30.rpx, 0, 0),
+ child: Container(
+ width: double.infinity,
+ constraints: BoxConstraints(
+ minHeight: 90.rpx,
+ ),
+ decoration: BoxDecoration(
+ color: themeController.currentColor.sc5),
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 30.rpx, 15.rpx, 30.rpx, 15.rpx),
+ child: Row(
+ mainAxisSize: MainAxisSize.max,
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ "消息提醒设置".tr,
+ style: TextStyle(
+ color: themeController.currentColor.sc3,
+ fontSize:
+ AppConstants().title_text_fontSize),
+ ),
+ ),
+ Obx(() {
+ return GradientSwitch(
+ value: commonMessageSettingController
+ .model.setting ==
+ 1
+ ? (messageSettingController
+ .model.setting ==
+ 1
+ ? true
+ : false)
+ : false,
+ onChanged: (val) {
+ if (commonMessageSettingController
+ .model.setting ==
+ 0) {
+ TopSlideNotification.show(context,
+ text: "请先在设置里的消息通知打开全部消息配置".tr,
+ textColor: themeController
+ .currentColor.sc9);
+ return;
+ }
+ String serviceAddress =
+ ServiceConstant.service_address;
+ String serviceName =
+ ServiceConstant.server_service;
+ String serviceApi =
+ ServiceConstant.user_setting;
+ String mac = widget.data['mac'];
+ String type =
+ "user_device_message_setting_$mac";
+ String queryUrl =
+ "${serviceAddress}${serviceName}${serviceApi}";
+ var data = {
+ "type": type,
+ "setting": val == true ? 1 : 0,
+ "appSetting": messageSettingController
+ .model.appSetting,
+ "serviceSetting":
+ messageSettingController
+ .model.serviceSetting,
+ };
+ requestWithLog(
+ logTitle: "更新消息推送状态",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ _fetchDeviceMessageSetting();
+ messageSettingController
+ .updateAll();
+ });
+ },
+ activeGradient: LinearGradient(
+ colors: [
+ themeController.currentColor.sc1,
+ themeController.currentColor.sc2
+ ],
+ ),
+ activeThumbColor: Colors.white,
+ inactiveThumbColor:
+ stringToColor("#A2A4A9"),
+ inactiveColor: stringToColor("#161B28"),
+ );
+ }),
+ ],
+ ),
+ ),
+ ),
+ ),
+ Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 30.rpx, 21.rpx, 30.rpx, 0),
+ child: Container(
+ decoration: BoxDecoration(
+ color: themeController.currentColor.sc5,
+ borderRadius: BorderRadius.circular(
+ AppConstants().normal_container_radius),
+ ),
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 30.rpx, 40.rpx, 30.rpx, 54.rpx),
+ child: Container(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisSize: MainAxisSize.max,
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ "APP消息".tr,
+ style: TextStyle(
+ color: themeController
+ .currentColor.sc3,
+ fontSize: AppConstants()
+ .title_text_fontSize),
+ ),
+ ),
+ Obx(() {
+ return GradientSwitch(
+ value: commonMessageSettingController
+ .model.setting ==
+ 1
+ ? (messageSettingController
+ .model.setting ==
+ 1
+ ? (messageSettingController
+ .model
+ .appSetting ==
+ 1
+ ? true
+ : false)
+ : false)
+ : false,
+ onChanged: (val) {
+ if (commonMessageSettingController
+ .model.setting ==
+ 0) {
+ TopSlideNotification.show(context,
+ text:
+ "请先在设置里的消息通知打开全部消息配置".tr,
+ textColor: themeController
+ .currentColor.sc9);
+ return;
+ }
+ if (messageSettingController
+ .model.setting ==
+ 0) {
+ TopSlideNotification.show(context,
+ text: "请先打开消息提醒设置".tr,
+ textColor: themeController
+ .currentColor.sc9);
+ return;
+ }
+ String serviceAddress =
+ ServiceConstant.service_address;
+ String serviceName =
+ ServiceConstant.server_service;
+ String serviceApi =
+ ServiceConstant.user_setting;
+ String mac = widget.data['mac'];
+ String type =
+ "user_device_message_setting_$mac";
+ String queryUrl =
+ "${serviceAddress}${serviceName}${serviceApi}";
+ var data = {
+ "type": type,
+ "setting":
+ messageSettingController
+ .model.setting,
+ "appSetting": val == true ? 1 : 0,
+ "serviceSetting":
+ messageSettingController
+ .model.serviceSetting,
+ };
+ requestWithLog(
+ logTitle: "更新消息推送状态",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ _fetchDeviceMessageSetting();
+ messageSettingController
+ .updateAll();
+ });
+ },
+ activeGradient: LinearGradient(
+ colors: [
+ themeController.currentColor.sc1,
+ themeController.currentColor.sc2
+ ],
+ ),
+ activeThumbColor: Colors.white,
+ inactiveThumbColor:
+ stringToColor("#A2A4A9"),
+ inactiveColor:
+ stringToColor("#161B28"),
+ );
+ }),
+ ],
+ ),
+ Text(
+ "APP消息介绍".tr,
+ style: TextStyle(
+ color: themeController.currentColor.sc4,
+ fontSize: AppConstants()
+ .normal_text_fontSize),
+ ),
+ Row(
+ mainAxisSize: MainAxisSize.max,
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ "服务号消息".tr,
+ style: TextStyle(
+ color: themeController
+ .currentColor.sc3,
+ fontSize: AppConstants()
+ .title_text_fontSize),
+ ),
+ ),
+ Obx(() {
+ return GradientSwitch(
+ value: commonMessageSettingController
+ .model.setting ==
+ 1
+ ? (messageSettingController
+ .model.setting ==
+ 1
+ ? (messageSettingController
+ .model
+ .serviceSetting ==
+ 1
+ ? true
+ : false)
+ : false)
+ : false,
+ onChanged: (val) {
+ if (commonMessageSettingController
+ .model.setting ==
+ 0) {
+ TopSlideNotification.show(context,
+ text:
+ "请先在设置里的消息通知打开全部消息配置".tr,
+ textColor: themeController
+ .currentColor.sc9);
+ return;
+ }
+ if (messageSettingController
+ .model.setting ==
+ 0) {
+ TopSlideNotification.show(context,
+ text: "请先打开消息提醒设置".tr,
+ textColor: themeController
+ .currentColor.sc9);
+ return;
+ }
+ String serviceAddress =
+ ServiceConstant.service_address;
+ String serviceName =
+ ServiceConstant.server_service;
+ String serviceApi =
+ ServiceConstant.user_setting;
+ String mac = widget.data['mac'];
+ String type =
+ "user_device_message_setting_$mac";
+ String queryUrl =
+ "${serviceAddress}${serviceName}${serviceApi}";
+ var data = {
+ "type": type,
+ "setting":
+ messageSettingController
+ .model.setting,
+ "appSetting":
+ messageSettingController
+ .model.appSetting,
+ "serviceSetting":
+ val == true ? 1 : 0,
+ };
+ requestWithLog(
+ logTitle: "更新消息推送状态",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ _fetchDeviceMessageSetting();
+ messageSettingController
+ .updateAll();
+ });
+ },
+ activeGradient: LinearGradient(
+ colors: [
+ themeController.currentColor.sc1,
+ themeController.currentColor.sc2
+ ],
+ ),
+ activeThumbColor: Colors.white,
+ inactiveThumbColor:
+ stringToColor("#A2A4A9"),
+ inactiveColor:
+ stringToColor("#161B28"),
+ );
+ }),
+ ],
+ ),
+ Text(
+ "服务号消息介绍".tr,
+ style: TextStyle(
+ color: themeController.currentColor.sc4,
+ fontSize: AppConstants()
+ .normal_text_fontSize),
+ ),
+ ].divide(SizedBox(
+ height: 49.rpx,
+ )),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/pages/device/component/ReviewMessageWidgetWidget.dart b/lib/pages/device/component/ReviewMessageWidgetWidget.dart
index 819a78b..21f55e1 100644
--- a/lib/pages/device/component/ReviewMessageWidgetWidget.dart
+++ b/lib/pages/device/component/ReviewMessageWidgetWidget.dart
@@ -28,7 +28,7 @@ class _ReviewMessageWidgetWidgetState extends State {
var messageInfo = widget.data;
return ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
- highlightColor: themeController.currentColor.sc3,
+ highlightColor: themeController.currentColor.sc21,
borderRadius: 20.rpx,
padding: EdgeInsetsDirectional.fromSTEB(31.rpx, 33.rpx, 0.rpx, 33.rpx),
onTap: () {},
diff --git a/lib/pages/device/message_review_page.dart b/lib/pages/device/message_review_page.dart
index 07bc4c5..e0101a3 100644
--- a/lib/pages/device/message_review_page.dart
+++ b/lib/pages/device/message_review_page.dart
@@ -92,7 +92,7 @@ class _MessageReviewPageState extends State {
child: ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
highlightColor:
- themeController.currentColor.sc5, // 或你希望的点击水波纹颜色
+ themeController.currentColor.sc21, // 或你希望的点击水波纹颜色
borderRadius: AppConstants()
.normal_container_radius, // 如果你想加圆角可以设置 eg. 12.rpx
padding: EdgeInsets.zero,
@@ -288,48 +288,49 @@ class _MessageReviewPageState extends State {
// RepairController repairController = Get.find();
// repairController.repairHistory.value = apiResponse.data;
// repairController.updateAll();
- messageReviewController.messageList.value = [
- {
- "data": {
- "title": "实时监测结果通知",
- 'val': [
- {'k': '消息类型', 'v': '心率异常'},
- {'k': '检测数值', 'v': '106'},
- {'k': '发生时间', 'v': '2024-07-30 01:15'},
- ],
- }
- },
- {
- "data": {
- "title": "实时监测结果通知",
- 'val': [
- {'k': '消息类型', 'v': '心率异常'},
- {'k': '检测数值', 'v': '106'},
- {'k': '发生时间', 'v': '2024-07-30 01:15'},
- ],
- }
- },
- {
- "data": {
- "title": "实时监测结果通知",
- 'val': [
- {'k': '消息类型', 'v': '心率异常'},
- {'k': '检测数值', 'v': '106'},
- {'k': '发生时间', 'v': '2024-07-30 01:15'},
- ],
- }
- },
- {
- "data": {
- "title": "实时监测结果通知",
- 'val': [
- {'k': '消息类型', 'v': '心率异常'},
- {'k': '检测数值', 'v': '106'},
- {'k': '发生时间', 'v': '2024-07-30 01:15'},
- ],
- }
- },
- ];
+
+ // messageReviewController.messageList.value = [
+ // {
+ // "data": {
+ // "title": "实时监测结果通知",
+ // 'val': [
+ // {'k': '消息类型', 'v': '心率异常'},
+ // {'k': '检测数值', 'v': '106'},
+ // {'k': '发生时间', 'v': '2024-07-30 01:15'},
+ // ],
+ // }
+ // },
+ // {
+ // "data": {
+ // "title": "实时监测结果通知",
+ // 'val': [
+ // {'k': '消息类型', 'v': '心率异常'},
+ // {'k': '检测数值', 'v': '106'},
+ // {'k': '发生时间', 'v': '2024-07-30 01:15'},
+ // ],
+ // }
+ // },
+ // {
+ // "data": {
+ // "title": "实时监测结果通知",
+ // 'val': [
+ // {'k': '消息类型', 'v': '心率异常'},
+ // {'k': '检测数值', 'v': '106'},
+ // {'k': '发生时间', 'v': '2024-07-30 01:15'},
+ // ],
+ // }
+ // },
+ // {
+ // "data": {
+ // "title": "实时监测结果通知",
+ // 'val': [
+ // {'k': '消息类型', 'v': '心率异常'},
+ // {'k': '检测数值', 'v': '106'},
+ // {'k': '发生时间', 'v': '2024-07-30 01:15'},
+ // ],
+ // }
+ // },
+ // ];
}
Widget _buildMessageListView(List dataList) {
diff --git a/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart b/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart
index 01fc768..7c7a9b6 100644
--- a/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart
+++ b/lib/pages/device_bind/componnet/SingleBlueteethDeviceCompoentWidget.dart
@@ -44,10 +44,13 @@ class _SingleBlueteethDeviceCompoentWidgetState
deviceData.mac = deviceData.deviceId.replaceAll(':', '');
BleDeviceData device = deviceData;
// blueteethBindController.currentDeviceMac = device.mac;
- device = blueteethBindController.model.betDevicelist!.firstWhere(
- (d) => d.mac == device.mac,
- orElse: () => device,
- );
+ final match = blueteethBindController.model.betDevicelist!
+ .firstWhereOrNull((d) => d.mac == device.mac);
+
+ if (match == null) {
+ return Container();
+ }
+ device = match;
return ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
highlightColor: themeController.currentColor.sc21,
diff --git a/lib/pages/device_bind/device_calibration.dart b/lib/pages/device_bind/device_calibration.dart
index 7331c90..923a4a2 100644
--- a/lib/pages/device_bind/device_calibration.dart
+++ b/lib/pages/device_bind/device_calibration.dart
@@ -28,8 +28,8 @@ class CalibrationPage extends StatefulWidget {
class _CalibrationPageState extends State {
DeviceCalibrationController deviceCalibrationController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
- int flag = 0; //默认没有开始校准过
- bool exit = false;
+ int flag = 0; //默认没有开始校准过 0没有开始
+ bool exit = false;
@override
void initState() {
super.initState();
@@ -86,7 +86,6 @@ class _CalibrationPageState extends State {
Positioned(
left: 0,
child: returnIconButtomAddCallback(() {
-
if (flag != 0) {
try {
showConfirmDialog(
@@ -114,7 +113,7 @@ class _CalibrationPageState extends State {
if (exit) {
Get.back();
}
- },enableBack:exit ),
+ }, enableBack: exit),
),
if (widget.type == 1)
Positioned(
@@ -561,11 +560,11 @@ class _CalibrationPageState extends State {
borderRadius:
AppConstants().button_container_radius, // 圆角半径
onTap: () async {
- flag = 1;
if (deviceCalibrationController.complete) {
showConfirmDialog(
context, Container(), "校准已经完成,是否重新开始校准?",
onConfirm: () {
+ flag = 1;
BlueteethBindController
blueteethBindController = Get.find();
deviceCalibrationController.process.value = 0;
@@ -723,6 +722,7 @@ class _CalibrationPageState extends State {
return;
});
} else {
+ flag = 1;
BlueteethBindController
blueteethBindController = Get.find();
String serviceAddress =
diff --git a/lib/pages/device_bind/device_share_page.dart b/lib/pages/device_bind/device_share_page.dart
index ad1bcf4..b025764 100644
--- a/lib/pages/device_bind/device_share_page.dart
+++ b/lib/pages/device_bind/device_share_page.dart
@@ -369,55 +369,56 @@ class _DeviceSharePageState extends State {
),
),
),
- Padding(
- padding:
- EdgeInsetsDirectional.fromSTEB(0, 379.rpx, 0, 0),
- child: CustomCard(
- borderRadius:
- AppConstants().button_container_radius, // 圆角半径
- onTap: () async {
- // TopSlideNotification.show(context,
- // text: "待开发功能".tr);
- LoginController loginController = Get.find();
- // loginController.fluwx.share(WeChatShareTextModel(
- // "太和e护分享链接",
- // scene: WeChatScene.session));
- final Uint8List data = await rootBundle.load('assets/img/camera.png').then((bd) => bd.buffer.asUint8List());
- loginController.fluwx.share(WeChatShareWebPageModel("taihecare://goods?id=123",title: "标题",description: "描述",thumbData: data));
- },
- colors: [
- // 渐变色
- themeController.currentColor.sc1,
- themeController.currentColor.sc2,
- ],
- child: Container(
- width: MediaQuery.sizeOf(context).width * 0.66,
- height: MediaQuery.sizeOf(context).height * 0.055,
- constraints: BoxConstraints(
- minWidth: 500.rpx,
- minHeight: 90.rpx,
- ),
- child: Row(
- mainAxisSize: MainAxisSize.max,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- '微信好友一键分享'.tr,
- style: FlutterFlowTheme.of(context)
- .bodyMedium
- .override(
- color: themeController.currentColor.sc3,
- fontFamily: 'Inter',
- fontSize: AppConstants()
- .normal_text_fontSize, // 自定义字体大小
- letterSpacing: 0.0,
- ),
- ),
- ].divide(SizedBox(width: 17.rpx)),
- ),
- ),
- ),
- ),
+
+ // Padding(
+ // padding:
+ // EdgeInsetsDirectional.fromSTEB(0, 379.rpx, 0, 0),
+ // child: CustomCard(
+ // borderRadius:
+ // AppConstants().button_container_radius, // 圆角半径
+ // onTap: () async {
+ // // TopSlideNotification.show(context,
+ // // text: "待开发功能".tr);
+ // LoginController loginController = Get.find();
+ // // loginController.fluwx.share(WeChatShareTextModel(
+ // // "太和e护分享链接",
+ // // scene: WeChatScene.session));
+ // final Uint8List data = await rootBundle.load('assets/img/camera.png').then((bd) => bd.buffer.asUint8List());
+ // loginController.fluwx.share(WeChatShareWebPageModel("taihecare://goods?id=123",title: "标题",description: "描述",thumbData: data));
+ // },
+ // colors: [
+ // // 渐变色
+ // themeController.currentColor.sc1,
+ // themeController.currentColor.sc2,
+ // ],
+ // child: Container(
+ // width: MediaQuery.sizeOf(context).width * 0.66,
+ // height: MediaQuery.sizeOf(context).height * 0.055,
+ // constraints: BoxConstraints(
+ // minWidth: 500.rpx,
+ // minHeight: 90.rpx,
+ // ),
+ // child: Row(
+ // mainAxisSize: MainAxisSize.max,
+ // mainAxisAlignment: MainAxisAlignment.center,
+ // children: [
+ // Text(
+ // '微信好友一键分享'.tr,
+ // style: FlutterFlowTheme.of(context)
+ // .bodyMedium
+ // .override(
+ // color: themeController.currentColor.sc3,
+ // fontFamily: 'Inter',
+ // fontSize: AppConstants()
+ // .normal_text_fontSize, // 自定义字体大小
+ // letterSpacing: 0.0,
+ // ),
+ // ),
+ // ].divide(SizedBox(width: 17.rpx)),
+ // ),
+ // ),
+ // ),
+ // ),
],
),
),
diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart
index 1e6c102..3224bbc 100644
--- a/lib/pages/login/login.dart
+++ b/lib/pages/login/login.dart
@@ -96,6 +96,7 @@ class _EPageState extends State {
),
),
child: Scaffold(
+ resizeToAvoidBottomInset: false,
backgroundColor: Colors.transparent,
body: SafeArea(
top: true,
@@ -506,22 +507,20 @@ class _EPageState extends State {
// },
onTap: () async {
//loginController.model.isIos == true &&
- if (loginController
- .model.register_agree ==
- null ||
- loginController
- .model.register_agree !=
- true) {
- TopSlideNotification.show(
- context,
- text: "登录页.未同意协议".tr,
- textColor:
- themeController.currentColor.sc9,
- );
- return;
- }
- await loginController
- .wxLoginSendAuth(context);
+ if (loginController.model.register_agree ==
+ null ||
+ loginController.model.register_agree !=
+ true) {
+ TopSlideNotification.show(
+ context,
+ text: "登录页.未同意协议".tr,
+ textColor:
+ themeController.currentColor.sc9,
+ );
+ return;
+ }
+ await loginController
+ .wxLoginSendAuth(context);
},
child: Container(
width: 91.rpx,
diff --git a/lib/pages/login/other_login.dart b/lib/pages/login/other_login.dart
index f2f7fc4..1aa9b51 100644
--- a/lib/pages/login/other_login.dart
+++ b/lib/pages/login/other_login.dart
@@ -3,8 +3,11 @@ import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
+import 'package:fluwx/fluwx.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/CheckNetwork.dart';
+import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
@@ -32,6 +35,60 @@ class _OtherLoginPageState extends State {
CountdownController countdownController = Get.find();
LoginController loginController = Get.find();
+ @override
+ void initState() {
+ // TODO: implement initState
+ super.initState();
+ super.initState();
+ LoginController loginController = Get.find();
+ Fluwx fluwx = loginController.fluwx;
+ if (isiOS) {
+ loginController.model.isIos = true;
+ fluwx.isWeChatInstalled.then((isWeChatInstalled) {
+ debugPrint('is wechat installed: $isWeChatInstalled');
+ if (!isWeChatInstalled) {
+ // TODO ios未安装微信 隐藏微信一键登录按钮
+ loginController.model.isWeChatNotInstalled = false;
+ } else {
+ loginController.model.isWeChatNotInstalled = true;
+ }
+ loginController.updateAll();
+ });
+ }
+ // 微信监听回调
+ loginController.fluwxCancelable = fluwx.addSubscriber((response) async {
+ if (response is WeChatAuthResponse) {
+ debugPrint('state :${response.state} \n code:${response.code}');
+ int errCode = response.errCode ?? -9999;
+ if (errCode == 0) {
+ // TODO 微信登录成功 传递code给后台 再操作逻辑
+ String code = response.code ?? "";
+ //把微信登录返回的code传给后台,剩下的事就交给后台处理
+ //首次未注册的用户引导去手机号填写页面
+ //已注册的用户直接跳转首页
+ if (CommonVariables.isNetWorkOn == false) {
+ showToast("网络未连接,请开启设备网络后重试");
+ return;
+ }
+ ApiResponse msg = await loginController.loginByWechatCode(code);
+ if (msg.code == HttpStatusCodes.ok) {
+ // TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
+ loginController.fluwxCancelable?.cancel();
+ // 登录成功移出网络检查监听
+ Checknetwork.subscription?.cancel();
+ Get.offAndToNamed("/mianPageBottomChange");
+ }
+ // TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
+ // fluwxCancelable?.cancel();
+ } else if (errCode == -4) {
+ showToast("用户拒绝授权");
+ } else if (errCode == -2) {
+ showToast("用户取消授权");
+ }
+ }
+ });
+ }
+
@override
Widget build(BuildContext context) {
return LayoutBuilder(
@@ -45,6 +102,7 @@ class _OtherLoginPageState extends State {
),
),
child: Scaffold(
+ resizeToAvoidBottomInset: false,
backgroundColor: Colors.transparent,
body: SafeArea(
top: true,
@@ -55,32 +113,27 @@ class _OtherLoginPageState extends State {
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Column(
- children: [
- SizedBox(
- height: 66.rpx,
+ SizedBox(
+ height: 66.rpx,
+ ),
+ ClickableContainer(
+ backgroundColor: Colors.transparent, // 容器背景色
+ highlightColor:
+ themeController.currentColor.sc21, // 点击时的背景色
+ padding: EdgeInsets.zero, // 这里去掉外部的 padding,避免影响点击范围
+ onTap: () {
+ Get.back();
+ },
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 16.rpx, 10.rpx, 16.rpx, 10.rpx),
+ child: SvgPicture.asset(
+ 'assets/img/icon/arrow_left.svg',
+ width: 25.rpx,
+ height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
+ color: themeController.currentColor.sc3,
),
- ClickableContainer(
- backgroundColor: Colors.transparent, // 容器背景色
- highlightColor:
- themeController.currentColor.sc21, // 点击时的背景色
- padding:
- EdgeInsets.zero, // 这里去掉外部的 padding,避免影响点击范围
- onTap: () {
- Get.back();
- },
- child: Padding(
- padding: EdgeInsetsDirectional.fromSTEB(
- 16.rpx, 10.rpx, 16.rpx, 10.rpx),
- child: SvgPicture.asset(
- 'assets/img/icon/arrow_left.svg',
- width: 25.rpx,
- height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
- color: themeController.currentColor.sc3,
- ),
- ),
- ),
- ],
+ ),
),
Expanded(
child: SingleChildScrollView(
@@ -827,22 +880,20 @@ class _OtherLoginPageState extends State {
padding: EdgeInsets.zero,
onTap: () async {
//loginController.model.isIos == true &&
- if (loginController
- .model.register_agree ==
- null ||
- loginController
- .model.register_agree !=
- true) {
- TopSlideNotification.show(
- context,
- text: "登录页.未同意协议".tr,
- textColor:
- themeController.currentColor.sc9,
- );
- return;
- }
- await loginController
- .wxLoginSendAuth(context);
+ if (loginController.model.register_agree ==
+ null ||
+ loginController.model.register_agree !=
+ true) {
+ TopSlideNotification.show(
+ context,
+ text: "登录页.未同意协议".tr,
+ textColor:
+ themeController.currentColor.sc9,
+ );
+ return;
+ }
+ await loginController
+ .wxLoginSendAuth(context);
},
child: Container(
width: 91.rpx,
diff --git a/lib/pages/main_bottom/mine_page.dart b/lib/pages/main_bottom/mine_page.dart
index c18dc60..36c5022 100644
--- a/lib/pages/main_bottom/mine_page.dart
+++ b/lib/pages/main_bottom/mine_page.dart
@@ -650,8 +650,8 @@ class _MinePageState extends State {
// themeController.currentColor.sc2,
// );
Get.toNamed("/newSleepReportPage",
- arguments: DateTime.now()
- .millisecondsSinceEpoch);
+ arguments: {'date':DateTime.now()
+ .millisecondsSinceEpoch,"mac":'aaaaaaeeeeeq','type':1});
}
},
child: Container(
@@ -693,7 +693,7 @@ class _MinePageState extends State {
mainAxisSize: MainAxisSize.max,
children: [
Text(
- 'V1.0.2505.20',
+ 'V1.0.2505.26',
style:
FlutterFlowTheme.of(context)
.bodyMedium
diff --git a/lib/pages/setting/common_mesaage_setting.dart b/lib/pages/setting/common_mesaage_setting.dart
new file mode 100644
index 0000000..d3b528c
--- /dev/null
+++ b/lib/pages/setting/common_mesaage_setting.dart
@@ -0,0 +1,896 @@
+import 'dart:async';
+
+import 'package:ef/ef.dart';
+import 'package:flutter/material.dart';
+import 'package:flutterflow_ui/flutterflow_ui.dart';
+import 'package:vbvs_app/common/color/ServiceConstant.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/common/util/requestWithLog.dart';
+import 'package:vbvs_app/component/base/GradientSwitch.dart';
+import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
+import 'package:vbvs_app/controller/message/common_message_setting_controller.dart';
+import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
+
+class CommonMessageSettingPage extends StatefulWidget {
+ CommonMessageSettingPage({super.key});
+
+ @override
+ State createState() =>
+ _CommonMessageSettingPageState();
+}
+
+class _CommonMessageSettingPageState extends State {
+ final ThemeController themeController = Get.find();
+ CommonMessageSettingController commonMessageSettingController = Get.find();
+
+ @override
+ void initState() {
+ super.initState();
+ _fetchDeviceList();
+ }
+
+ Future _fetchDeviceList() async {
+ String serviceAddress = ServiceConstant.service_address;
+ String serviceName = ServiceConstant.server_service;
+ String serviceApi = ServiceConstant.user_setting;
+ String type = "user_message_setting";
+ String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=$type";
+ requestWithLog(
+ logTitle: "查询用户消息配置",
+ method: MyHttpMethod.get,
+ queryUrl: queryUrl,
+ onSuccess: (res) {
+ if (res.data == null || res.data.isEmpty) {
+ var data = {
+ "type": type,
+ "setting": 1,
+ "appSetting": 1,
+ "serviceSetting": 1,
+ "tipSetting": 1,
+ "deviceUpgradeSetting": 1,
+ "deviceIssueSetting": 1,
+ };
+ requestWithLog(
+ logTitle: "更新用户消息配置",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ requestWithLog(
+ logTitle: "查询用户消息配置",
+ method: MyHttpMethod.get,
+ queryUrl: queryUrl,
+ onSuccess: (res) {
+ if (res.data != null && res.data.isNotEmpty) {
+ var datalist = res.data;
+ commonMessageSettingController.model.setting =
+ datalist['setting'];
+ commonMessageSettingController.model.appSetting =
+ datalist['appSetting'];
+ commonMessageSettingController.model.serviceSetting =
+ datalist['serviceSetting'];
+ commonMessageSettingController.model.tipSetting =
+ datalist['tipSetting'];
+ commonMessageSettingController.model.deviceUpgradeSetting =
+ datalist['deviceUpgradeSetting'];
+ commonMessageSettingController.model.deviceIssueSetting =
+ datalist['deviceIssueSetting'];
+ commonMessageSettingController.updateAll();
+ }
+ },
+ );
+
+ //
+ },
+ );
+ } else {
+ var datalist = res.data;
+ commonMessageSettingController.model.setting = datalist['setting'];
+ commonMessageSettingController.model.appSetting =
+ datalist['appSetting'];
+ commonMessageSettingController.model.serviceSetting =
+ datalist['serviceSetting'];
+ commonMessageSettingController.model.tipSetting =
+ datalist['tipSetting'];
+ commonMessageSettingController.model.deviceUpgradeSetting =
+ datalist['deviceUpgradeSetting'];
+ commonMessageSettingController.model.deviceIssueSetting =
+ datalist['deviceIssueSetting'];
+ commonMessageSettingController.updateAll();
+ }
+ },
+ onFailure: (res) {
+ print(res);
+ },
+ );
+ }
+
+ @override
+ void dispose() {
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return LayoutBuilder(
+ builder: (context, bodysize) => GestureDetector(
+ onTap: () => FocusScope.of(context).unfocus(),
+ child: Container(
+ decoration: BoxDecoration(
+ image: DecorationImage(
+ image: AssetImage('assets/img/bgNoImg.png'),
+ fit: BoxFit.fill,
+ ),
+ ),
+ child: Scaffold(
+ backgroundColor: Colors.transparent,
+ appBar: AppBar(
+ backgroundColor: themeController.currentColor.sc17,
+ automaticallyImplyLeading: false,
+ iconTheme: IconThemeData(
+ color: themeController.currentColor.sc3,
+ ),
+ titleSpacing: 0,
+ title: Container(
+ width: double.infinity,
+ height: 180.rpx,
+ child: Stack(
+ alignment: Alignment.center,
+ children: [
+ /// 居中标题
+ Text(
+ '消息通知'.tr,
+ style: TextStyle(
+ fontFamily: 'ReadexPro',
+ color: themeController.currentColor.sc3,
+ letterSpacing: 0,
+ fontSize: 30.rpx,
+ ),
+ ),
+ Positioned(
+ left: 0,
+ child: returnIconButtomAddCallback(() {}),
+ ),
+ ],
+ ),
+ ),
+ actions: [],
+ centerTitle: false,
+ ),
+ body: GestureDetector(
+ child: SafeArea(
+ top: true,
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(0.rpx, 0, 0.rpx, 0),
+ child: SingleChildScrollView(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Padding(
+ padding:
+ EdgeInsetsDirectional.fromSTEB(0, 30.rpx, 0, 0),
+ child: Container(
+ width: double.infinity,
+ constraints: BoxConstraints(
+ minHeight: 90.rpx,
+ ),
+ decoration: BoxDecoration(
+ color: themeController.currentColor.sc5),
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 30.rpx, 15.rpx, 30.rpx, 15.rpx),
+ child: Row(
+ mainAxisSize: MainAxisSize.max,
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ "全部消息".tr,
+ style: TextStyle(
+ color:
+ themeController.currentColor.sc3,
+ fontSize: AppConstants()
+ .title_text_fontSize),
+ ),
+ ),
+ Obx(() {
+ return GradientSwitch(
+ value: commonMessageSettingController
+ .model.setting ==
+ 1
+ ? true
+ : false,
+ onChanged: (val) {
+ String serviceAddress =
+ ServiceConstant.service_address;
+ String serviceName =
+ ServiceConstant.server_service;
+ String serviceApi =
+ ServiceConstant.user_setting;
+ String type = "user_message_setting";
+ String queryUrl =
+ "${serviceAddress}${serviceName}${serviceApi}";
+ var data = {
+ "type": type,
+ "setting": val == true ? 1 : 0,
+ "appSetting":
+ commonMessageSettingController
+ .model.appSetting,
+ "serviceSetting":
+ commonMessageSettingController
+ .model.serviceSetting,
+ "tipSetting":
+ commonMessageSettingController
+ .model.tipSetting,
+ "deviceUpgradeSetting":
+ commonMessageSettingController
+ .model.deviceUpgradeSetting,
+ "deviceIssueSetting":
+ commonMessageSettingController
+ .model.deviceIssueSetting,
+ };
+ requestWithLog(
+ logTitle: "更新消息推送状态",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ _fetchDeviceList();
+ commonMessageSettingController
+ .updateAll();
+ });
+ },
+ activeGradient: LinearGradient(
+ colors: [
+ themeController.currentColor.sc1,
+ themeController.currentColor.sc2
+ ],
+ ),
+ activeThumbColor: Colors.white,
+ inactiveThumbColor:
+ stringToColor("#A2A4A9"),
+ inactiveColor: stringToColor("#161B28"),
+ );
+ }),
+ ],
+ ),
+ ),
+ ),
+ ),
+ Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 30.rpx, 21.rpx, 30.rpx, 0),
+ child: Container(
+ decoration: BoxDecoration(
+ color: themeController.currentColor.sc5,
+ borderRadius: BorderRadius.circular(
+ AppConstants().normal_container_radius),
+ ),
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 30.rpx, 40.rpx, 30.rpx, 54.rpx),
+ child: Container(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisSize: MainAxisSize.max,
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ "APP消息".tr,
+ style: TextStyle(
+ color: themeController
+ .currentColor.sc3,
+ fontSize: AppConstants()
+ .title_text_fontSize),
+ ),
+ ),
+ Obx(() {
+ return GradientSwitch(
+ value: commonMessageSettingController
+ .model.setting ==
+ 1
+ ? (commonMessageSettingController
+ .model.appSetting ==
+ 1
+ ? true
+ : false)
+ : false,
+ onChanged: (val) {
+ if (commonMessageSettingController
+ .model.setting ==
+ 0) {
+ TopSlideNotification.show(
+ context,
+ text: "请先打开全部消息配置".tr,
+ textColor: themeController
+ .currentColor.sc9);
+ return;
+ }
+ String serviceAddress =
+ ServiceConstant
+ .service_address;
+ String serviceName =
+ ServiceConstant
+ .server_service;
+ String serviceApi =
+ ServiceConstant.user_setting;
+ String type =
+ "user_message_setting";
+ String queryUrl =
+ "${serviceAddress}${serviceName}${serviceApi}";
+ var data = {
+ "type": type,
+ "setting":
+ commonMessageSettingController
+ .model.setting,
+ "appSetting":
+ val == true ? 1 : 0,
+ "serviceSetting":
+ commonMessageSettingController
+ .model.serviceSetting,
+ "tipSetting":
+ commonMessageSettingController
+ .model.tipSetting,
+ "deviceUpgradeSetting":
+ commonMessageSettingController
+ .model
+ .deviceUpgradeSetting,
+ "deviceIssueSetting":
+ commonMessageSettingController
+ .model
+ .deviceIssueSetting,
+ };
+ requestWithLog(
+ logTitle: "更新消息推送状态",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ _fetchDeviceList();
+ commonMessageSettingController
+ .updateAll();
+ });
+ },
+ activeGradient: LinearGradient(
+ colors: [
+ themeController
+ .currentColor.sc1,
+ themeController.currentColor.sc2
+ ],
+ ),
+ activeThumbColor: Colors.white,
+ inactiveThumbColor:
+ stringToColor("#A2A4A9"),
+ inactiveColor:
+ stringToColor("#161B28"),
+ );
+ }),
+ ],
+ ),
+ Text(
+ "通用APP消息介绍".tr,
+ style: TextStyle(
+ color:
+ themeController.currentColor.sc4,
+ fontSize: AppConstants()
+ .normal_text_fontSize),
+ ),
+ Row(
+ mainAxisSize: MainAxisSize.max,
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ "服务号消息".tr,
+ style: TextStyle(
+ color: themeController
+ .currentColor.sc3,
+ fontSize: AppConstants()
+ .title_text_fontSize),
+ ),
+ ),
+ Obx(() {
+ return GradientSwitch(
+ value: commonMessageSettingController
+ .model.setting ==
+ 1
+ ? (commonMessageSettingController
+ .model
+ .serviceSetting ==
+ 1
+ ? true
+ : false)
+ : false,
+ onChanged: (val) {
+ if (commonMessageSettingController
+ .model.setting ==
+ 0) {
+ TopSlideNotification.show(
+ context,
+ text: "请先打开全部消息配置".tr,
+ textColor: themeController
+ .currentColor.sc9);
+ return;
+ }
+ String serviceAddress =
+ ServiceConstant
+ .service_address;
+ String serviceName =
+ ServiceConstant
+ .server_service;
+ String serviceApi =
+ ServiceConstant.user_setting;
+ String type =
+ "user_message_setting";
+ String queryUrl =
+ "${serviceAddress}${serviceName}${serviceApi}";
+ var data = {
+ "type": type,
+ "setting":
+ commonMessageSettingController
+ .model.setting,
+ "appSetting":
+ commonMessageSettingController
+ .model.appSetting,
+ "serviceSetting":
+ val == true ? 1 : 0,
+ "tipSetting":
+ commonMessageSettingController
+ .model.tipSetting,
+ "deviceUpgradeSetting":
+ commonMessageSettingController
+ .model
+ .deviceUpgradeSetting,
+ "deviceIssueSetting":
+ commonMessageSettingController
+ .model
+ .deviceIssueSetting,
+ };
+ requestWithLog(
+ logTitle: "更新消息推送状态",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ _fetchDeviceList();
+ commonMessageSettingController
+ .updateAll();
+ });
+ },
+ activeGradient: LinearGradient(
+ colors: [
+ themeController
+ .currentColor.sc1,
+ themeController.currentColor.sc2
+ ],
+ ),
+ activeThumbColor: Colors.white,
+ inactiveThumbColor:
+ stringToColor("#A2A4A9"),
+ inactiveColor:
+ stringToColor("#161B28"),
+ );
+ }),
+ ],
+ ),
+ Text(
+ "通用服务号消息介绍".tr,
+ style: TextStyle(
+ color:
+ themeController.currentColor.sc4,
+ fontSize: AppConstants()
+ .normal_text_fontSize),
+ ),
+ ].divide(SizedBox(
+ height: 49.rpx,
+ )),
+ ),
+ ),
+ ),
+ ),
+ ),
+ // Padding(
+ // padding:
+ // EdgeInsetsDirectional.fromSTEB(0, 30.rpx, 0, 0),
+ // child: Container(
+ // width: double.infinity,
+ // constraints: BoxConstraints(
+ // minHeight: 90.rpx,
+ // ),
+ // decoration: BoxDecoration(
+ // color: themeController.currentColor.sc5),
+ // child: Padding(
+ // padding: EdgeInsetsDirectional.fromSTEB(
+ // 30.rpx, 15.rpx, 30.rpx, 15.rpx),
+ // child: Column(
+ // crossAxisAlignment: CrossAxisAlignment.start,
+ // children: [
+ // Row(
+ // mainAxisSize: MainAxisSize.max,
+ // mainAxisAlignment:
+ // MainAxisAlignment.spaceBetween,
+ // children: [
+ // Expanded(
+ // child: Text(
+ // "绑定操作提示".tr,
+ // style: TextStyle(
+ // color: themeController
+ // .currentColor.sc3,
+ // fontSize: AppConstants()
+ // .title_text_fontSize),
+ // ),
+ // ),
+ // Obx(() {
+ // return GradientSwitch(
+ // value: commonMessageSettingController
+ // .model.setting ==
+ // 1
+ // ? (commonMessageSettingController
+ // .model.tipSetting ==
+ // 1
+ // ? true
+ // : false)
+ // : false,
+ // onChanged: (val) {
+ // if (commonMessageSettingController
+ // .model.setting ==
+ // 0) {
+ // TopSlideNotification.show(
+ // context,
+ // text: "请先打开全部消息配置".tr,
+ // textColor: themeController
+ // .currentColor.sc9);
+ // return;
+ // }
+ // String serviceAddress =
+ // ServiceConstant
+ // .service_address;
+ // String serviceName =
+ // ServiceConstant
+ // .server_service;
+ // String serviceApi =
+ // ServiceConstant.user_setting;
+ // String type =
+ // "user_message_setting";
+ // String queryUrl =
+ // "${serviceAddress}${serviceName}${serviceApi}";
+ // var data = {
+ // "type": type,
+ // "setting":
+ // commonMessageSettingController
+ // .model.setting,
+ // "appSetting":
+ // commonMessageSettingController
+ // .model.appSetting,
+ // "serviceSetting":
+ // commonMessageSettingController
+ // .model.serviceSetting,
+ // "tipSetting":
+ // val == true ? 1 : 0,
+ // "deviceUpgradeSetting":
+ // commonMessageSettingController
+ // .model
+ // .deviceUpgradeSetting,
+ // "deviceIssueSetting":
+ // commonMessageSettingController
+ // .model
+ // .deviceIssueSetting,
+ // };
+ // requestWithLog(
+ // logTitle: "更新消息推送状态",
+ // method: MyHttpMethod.put,
+ // queryUrl: queryUrl,
+ // data: data,
+ // onSuccess: (res) {
+ // _fetchDeviceList();
+ // commonMessageSettingController
+ // .updateAll();
+ // });
+ // },
+ // activeGradient: LinearGradient(
+ // colors: [
+ // themeController
+ // .currentColor.sc1,
+ // themeController.currentColor.sc2
+ // ],
+ // ),
+ // activeThumbColor: Colors.white,
+ // inactiveThumbColor:
+ // stringToColor("#A2A4A9"),
+ // inactiveColor:
+ // stringToColor("#161B28"),
+ // );
+ // }),
+ // ],
+ // ),
+ // // Text(
+ // // "绑定操作提示介绍".tr,
+ // // style: TextStyle(
+ // // color:
+ // // themeController.currentColor.sc4,
+ // // fontSize: AppConstants()
+ // // .normal_text_fontSize),
+ // // ),
+ // ].divide(SizedBox(
+ // height: 49.rpx,
+ // )),
+ // )),
+ // ),
+ // ),
+
+ Padding(
+ padding:
+ EdgeInsetsDirectional.fromSTEB(0, 30.rpx, 0, 0),
+ child: Container(
+ width: double.infinity,
+ constraints: BoxConstraints(
+ minHeight: 90.rpx,
+ ),
+ decoration: BoxDecoration(
+ color: themeController.currentColor.sc5),
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 30.rpx, 15.rpx, 30.rpx, 15.rpx),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisSize: MainAxisSize.max,
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ "设备故障通知".tr,
+ style: TextStyle(
+ color: themeController
+ .currentColor.sc3,
+ fontSize: AppConstants()
+ .title_text_fontSize),
+ ),
+ ),
+ Obx(() {
+ return GradientSwitch(
+ value: commonMessageSettingController
+ .model.setting ==
+ 1
+ ? (commonMessageSettingController
+ .model
+ .deviceUpgradeSetting ==
+ 1
+ ? true
+ : false)
+ : false,
+ onChanged: (val) {
+ if (commonMessageSettingController
+ .model.setting ==
+ 0) {
+ TopSlideNotification.show(
+ context,
+ text: "请先打开全部消息配置".tr,
+ textColor: themeController
+ .currentColor.sc9);
+ return;
+ }
+ String serviceAddress =
+ ServiceConstant
+ .service_address;
+ String serviceName =
+ ServiceConstant
+ .server_service;
+ String serviceApi =
+ ServiceConstant.user_setting;
+ String type =
+ "user_message_setting";
+ String queryUrl =
+ "${serviceAddress}${serviceName}${serviceApi}";
+ var data = {
+ "type": type,
+ "setting":
+ commonMessageSettingController
+ .model.setting,
+ "appSetting":
+ commonMessageSettingController
+ .model.appSetting,
+ "serviceSetting":
+ commonMessageSettingController
+ .model.serviceSetting,
+ "tipSetting":
+ commonMessageSettingController
+ .model.tipSetting,
+ "deviceUpgradeSetting":
+ val == true ? 1 : 0,
+ "deviceIssueSetting":
+ commonMessageSettingController
+ .model
+ .deviceIssueSetting,
+ };
+ requestWithLog(
+ logTitle: "更新消息推送状态",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ _fetchDeviceList();
+ commonMessageSettingController
+ .updateAll();
+ });
+ },
+ activeGradient: LinearGradient(
+ colors: [
+ themeController
+ .currentColor.sc1,
+ themeController.currentColor.sc2
+ ],
+ ),
+ activeThumbColor: Colors.white,
+ inactiveThumbColor:
+ stringToColor("#A2A4A9"),
+ inactiveColor:
+ stringToColor("#161B28"),
+ );
+ }),
+ ],
+ ),
+ // Text(
+ // "绑定操作提示介绍".tr,
+ // style: TextStyle(
+ // color:
+ // themeController.currentColor.sc4,
+ // fontSize: AppConstants()
+ // .normal_text_fontSize),
+ // ),
+ ].divide(SizedBox(
+ height: 49.rpx,
+ )),
+ )),
+ ),
+ ),
+ Padding(
+ padding:
+ EdgeInsetsDirectional.fromSTEB(0, 30.rpx, 0, 0),
+ child: Container(
+ width: double.infinity,
+ constraints: BoxConstraints(
+ minHeight: 90.rpx,
+ ),
+ decoration: BoxDecoration(
+ color: themeController.currentColor.sc5),
+ child: Padding(
+ padding: EdgeInsetsDirectional.fromSTEB(
+ 30.rpx, 15.rpx, 30.rpx, 15.rpx),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisSize: MainAxisSize.max,
+ mainAxisAlignment:
+ MainAxisAlignment.spaceBetween,
+ children: [
+ Expanded(
+ child: Text(
+ "设备升级通知".tr,
+ style: TextStyle(
+ color: themeController
+ .currentColor.sc3,
+ fontSize: AppConstants()
+ .title_text_fontSize),
+ ),
+ ),
+ Obx(() {
+ return GradientSwitch(
+ value: commonMessageSettingController
+ .model.setting ==
+ 1
+ ? (commonMessageSettingController
+ .model
+ .deviceIssueSetting ==
+ 1
+ ? true
+ : false)
+ : false,
+ onChanged: (val) {
+ if (commonMessageSettingController
+ .model.setting ==
+ 0) {
+ TopSlideNotification.show(
+ context,
+ text: "请先打开全部消息配置".tr,
+ textColor: themeController
+ .currentColor.sc9);
+ return;
+ }
+ String serviceAddress =
+ ServiceConstant
+ .service_address;
+ String serviceName =
+ ServiceConstant
+ .server_service;
+ String serviceApi =
+ ServiceConstant.user_setting;
+ String type =
+ "user_message_setting";
+ String queryUrl =
+ "${serviceAddress}${serviceName}${serviceApi}";
+ var data = {
+ "type": type,
+ "setting":
+ commonMessageSettingController
+ .model.setting,
+ "appSetting":
+ commonMessageSettingController
+ .model.appSetting,
+ "serviceSetting":
+ commonMessageSettingController
+ .model.serviceSetting,
+ "tipSetting":
+ commonMessageSettingController
+ .model.tipSetting,
+ "deviceUpgradeSetting":
+ commonMessageSettingController
+ .model
+ .deviceUpgradeSetting,
+ "deviceIssueSetting":
+ val == true ? 1 : 0,
+ };
+ requestWithLog(
+ logTitle: "更新消息推送状态",
+ method: MyHttpMethod.put,
+ queryUrl: queryUrl,
+ data: data,
+ onSuccess: (res) {
+ _fetchDeviceList();
+ commonMessageSettingController
+ .updateAll();
+ });
+ },
+ activeGradient: LinearGradient(
+ colors: [
+ themeController
+ .currentColor.sc1,
+ themeController.currentColor.sc2
+ ],
+ ),
+ activeThumbColor: Colors.white,
+ inactiveThumbColor:
+ stringToColor("#A2A4A9"),
+ inactiveColor:
+ stringToColor("#161B28"),
+ );
+ }),
+ ],
+ ),
+ // Text(
+ // "绑定操作提示介绍".tr,
+ // style: TextStyle(
+ // color:
+ // themeController.currentColor.sc4,
+ // fontSize: AppConstants()
+ // .normal_text_fontSize),
+ // ),
+ ].divide(SizedBox(
+ height: 49.rpx,
+ )),
+ )),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/pages/sleep_report/chart/DataShowWidget.dart b/lib/pages/sleep_report/chart/DataShowWidget.dart
index c55b465..c022d07 100644
--- a/lib/pages/sleep_report/chart/DataShowWidget.dart
+++ b/lib/pages/sleep_report/chart/DataShowWidget.dart
@@ -50,7 +50,7 @@ class _DataShowWidgetState extends State {
children: [
// 放入传入的 widget1
Container(
- width: MediaQuery.sizeOf(context).width * 0.4, // 固定宽度
+ width: MediaQuery.sizeOf(context).width * 0.35, // 固定宽度
decoration: BoxDecoration(),
child: Align(
alignment: widget.alignment == MainAxisAlignment.start
diff --git a/lib/pages/sleep_report/chart/DotBarChart.dart b/lib/pages/sleep_report/chart/DotBarChart.dart
index 1ab0216..2406850 100644
--- a/lib/pages/sleep_report/chart/DotBarChart.dart
+++ b/lib/pages/sleep_report/chart/DotBarChart.dart
@@ -2,6 +2,7 @@ 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';
+import 'dart:ui' as ui;
class DotBarChart extends StatefulWidget {
final List