更新界面布局

This commit is contained in:
wyf
2025-06-04 11:54:01 +08:00
parent 40732066fe
commit 857317caf1
34 changed files with 4961 additions and 459 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 578 KiB

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@@ -420,6 +420,7 @@
"今日数据":"yesterday",
"昨日数据":"today",
"次":"times",
"秒":"sec"
"秒":"sec",
"暂无":"none"
}

View File

@@ -116,7 +116,7 @@
},
"绑定成功":{
"标题":"绑定完成",
"绑定成功":"绑定成功! ",
"绑定成功":"配置成功! ",
"分享标题":"是否进行分享?",
"分享内容":"设备绑定成功后,如需对朋友或家人共享我的睡眠情况,可以进行立即分享,分享成功后,对方即可享受查看该设备权限,可以收到该设备的睡眠报告。",
"立即分享":"立即分享",
@@ -428,7 +428,16 @@
"未配置网络提示":"当前设备未进行网络配置,是否确认跳过网络配置",
"退出":"退出",
"完成":"完成",
"时长":"时长:"
"时长":"时长:",
"继续":"继续",
"下次再说":"下次再说",
"发现":"发现!",
"检测到":"检测到",
"绑定流程未走完是否继续":"绑定流程未走完是否继续",
"暂无":"暂无",
"设备连接超时,请重试":"设备连接超时,请点击刷新重试",
"设备连接失败":"设备连接失败,请点击刷新重试"
}

View File

@@ -393,7 +393,7 @@ var returnIconButtomNew = ClickableContainer(
// ),
// );
var returnIconButtomAddCallback = (returnCallBack) {
var returnIconButtomAddCallback = (
VoidCallback? returnCallBack, {
bool enableBack = true,

View File

@@ -16,6 +16,7 @@ import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/main.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart';
part 'login_controller.g.dart';
@@ -199,10 +200,14 @@ class LoginController extends GetControllerEx<LoginModel> {
scope: 'snsapi_userinfo',
state: 'wechat_sdk_theh_wxlogin',
))
.then((data) {
.then((data) async {
//返回true表示成功或者false表示失败这边没有意义从login_controller页面构造函数监听中去处理
debugPrint('msg:$data');
EasyDartModule.logger.error('msg:$data');
if (data) {
//登陆成功
// await dealBindProcess();
}
});
} catch (e) {
debugPrint('msg:$e');

View File

@@ -47,6 +47,8 @@ class PersonController extends GetControllerEx<PersonModel> {
RxString height = "".obs;
DateTime? dateTime = DateTime.now(); //选择时间
RxList diseaseList = [].obs;
RxString update_person_mac = "".obs;
var after_deveice;
Future<ApiResponse> savePersonData() async {
try {

View File

@@ -17,7 +17,6 @@ import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart';
part 'user_info_controller.g.dart';
@JsonSerializable()
@@ -59,6 +58,9 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
attr = GetModel(UserInfoModel()).obs;
}
List device_bind_status = [];
int device_bind_flag = 0;//0。未初始化 1.已初始化
Future<ApiResponse> uploadImg() async {
EasyDartModule.logger.info("请求上传图片");
DailyLogUtils.writeLog("请求上传图片");
@@ -239,6 +241,4 @@ class UserInfoController extends GetControllerEx<UserInfoModel> {
countdownController.countdown.value = 0;
return apiResponse;
}
}

View File

@@ -16,6 +16,8 @@ import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/util/CheckNetwork.dart';
import 'package:vbvs_app/common/util/CommonVariables.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/date/CalendarController.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart';
@@ -56,10 +58,9 @@ import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/weather/weather_controller.dart';
import 'package:vbvs_app/language/AppLanguage.dart';
import 'package:vbvs_app/model/CustomThemeColor.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/model/user_data.dart';
import 'package:vbvs_app/pages/device_control/BackMovement.dart';
import 'package:vbvs_app/pages/device_control/MattressControl.dart';
import 'package:vbvs_app/pages/device_control/people_info.dart';
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
import 'package:vbvs_app/routers/mh_routers.dart';
@@ -208,12 +209,66 @@ Future<void> initLogin() async {
// 根据token去请求
// await userInfoController.autoLogin(token);
EasyDartModule.dio.token = token;
// await dealBindProcess();
} else {
// 如果没有 token则将用户标记为未登录
userInfoController.model.login = 0;
}
}
//处理绑定未完成的数据
Future<void> dealBindProcess() async {
UserInfoController userInfoController = Get.find();
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.device_list;
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?bindType=1";
userInfoController.device_bind_status = [];
try {
final res = await requestWithLog(
logTitle: "查询设备绑定列表",
method: MyHttpMethod.get,
queryUrl: queryUrl,
);
List data = res.data ?? [];
if (data.isNotEmpty) {
// 使用 Future.wait 等待所有设备的查询完成
await Future.wait(
data.map((element) async {
String mac = element['mac'];
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${ServiceConstant.user_setting}?type=${type}";
try {
final res = await requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
);
if (res.data != null && res.data.isNotEmpty) {
bool celibration = res.data['celibration'];
bool person_info = res.data['person_info'];
bool wifi = res.data['wifi'];
if (!celibration || !person_info || !wifi) {
res.data['device_info'] = element;
userInfoController.device_bind_status.add(res.data);
}
}
} catch (e) {
print("查询绑定流程失败: $e");
}
}),
);
}
} catch (e) {
print("查询设备绑定列表失败: $e");
}
}
class MyApp extends StatelessWidget {
MyApp({super.key});
final ThemeController themeController = Get.put(ThemeController());
@@ -257,7 +312,6 @@ class MyApp extends StatelessWidget {
Get.lazyPut(() => DeviceShareListController()),
Get.lazyPut(() => DeviceCalibrationController()),
Get.lazyPut(() => RepairController()),
Get.lazyPut(() => PdfController()),
]));
}
@@ -309,7 +363,7 @@ class MyApp extends StatelessWidget {
]));
}
final selectapp = "mht";
final selectapp = "th";
// This widget is the root of your application.
@override
Widget build(BuildContext context) {

View File

@@ -1043,6 +1043,8 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
widget.device['_id'];
personController.name.value =
widget.device['person']['name'];
personController.update_person_mac.value =
widget.device['mac'];
personController.gender.value =
widget.device['person']['gender'] ?? 1;
personController.weight?.value =
@@ -1065,8 +1067,16 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
MyUtils.formatBirthdayTime(
widget.device['person']['birthday']);
} else {
personController.update_person_mac.value =
widget.device['mac'];
personController.currentPersonId.value =
widget.device['_id'];
personController.name.value = "";
personController.gender.value = 1;
personController.dateTime = null;
personController.height.value = "";
personController.weight.value = "";
personController.diseaseList.value = [];
}
await Get.toNamed("/updatePersonPage",
arguments: widget.device['bind_type']);
@@ -1292,7 +1302,6 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
bodyDeviceController.wifiMac = device['mac'];
Get.toNamed("/wifiPagePerson", arguments: device);
return;
}
double _calculateMaxMenuItemWidth(List<String> texts, TextStyle style) {

View File

@@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
@@ -24,8 +25,9 @@ class DeviceStatusInfoWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
highlightColor: themeController.currentColor.sc5,
// backgroundColor: themeController.currentColor.sc5,
backgroundColor: stringToColor("#242835").withOpacity(0.8),
highlightColor: themeController.currentColor.sc21,
borderRadius: AppConstants().normal_container_radius,
padding: EdgeInsets.zero,
onTap: () {
@@ -76,7 +78,7 @@ class DeviceStatusInfoWidget extends StatelessWidget {
fontFamily: 'Inter',
fontSize: 30.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
color: themeController.currentColor.sc4,
),
),
].divide(SizedBox(height: 39.rpx)),

View File

@@ -169,6 +169,7 @@ class _MessageSettingPageState extends State<MessageSettingPage> {
print(res);
},
);
}
@override

View File

@@ -109,7 +109,7 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
minHeight: 200.rpx,
),
decoration: BoxDecoration(
color: Colors.transparent,
color: Colors.white,
),
child:
(widget.device['code']?.toString().isNotEmpty ??
@@ -124,6 +124,7 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
fit: BoxFit.cover,
),
),
SizedBox(height: 20.rpx),
Container(
height: 50.rpx,
decoration: BoxDecoration(),

View File

@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:EasyDartModule/EasyDartModule.dart' as edm;
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
@@ -17,6 +18,9 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/WebSocketMessage.dart';
import 'package:vbvs_app/pages/device/component/DeviceStatusInfoWidget.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/painting.dart';
import 'dart:ui' as ui;
class InstantBodyPage extends StatefulWidget {
var personInfo;
@@ -173,17 +177,421 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
),
body: SafeArea(
top: true,
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
(onlineState == "离线".tr || inBed == '离床'.tr)
? 'assets/img/black_body_still.png' // 静态图
: 'assets/img/body_black.gif', // 动图
),
fit: BoxFit.cover,
// child: Container(
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage(
// (onlineState == "离线".tr || inBed == '离床'.tr)
// ? 'assets/img/black_body_still.png' // 静态图
// : 'assets/img/body_black.gif', // 动图
// ),
// fit: BoxFit.cover,
// ),
// ),
// child: Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 0.rpx, 29.rpx, 0.rpx, 0.rpx),
// child: Column(
// mainAxisSize: MainAxisSize.max,
// children: [
// Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 30.rpx, 0.rpx, 30.rpx, 120.rpx),
// child: ClickableContainer(
// backgroundColor: themeController.currentColor.sc5,
// highlightColor:
// themeController.currentColor.sc5, // 或你希望的点击水波纹颜色
// borderRadius: AppConstants()
// .normal_container_radius, // 如果你想加圆角可以设置 eg. 12.rpx
// padding: EdgeInsets.zero,
// onTap: () {
// print('点击了体征卡片');
// },
// child: Row(
// mainAxisSize: MainAxisSize.max,
// children: [
// Flexible(
// flex: 2,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.end,
// children: [
// Text(
// '实时体征.姓名'.tr,
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc4,
// ),
// ),
// Text(
// '实时体征.年龄'.tr,
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc4,
// ),
// ),
// ].divide(SizedBox(height: 34.rpx)),
// ),
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// '${device['person']?['name'] ?? '未命名'.tr}',
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc3,
// ),
// ),
// Text(
// '${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(device['person']?['birthday'])) ?? '未知数据'.tr}',
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc3,
// ),
// ),
// ].divide(SizedBox(height: 34.rpx)),
// ),
// ]
// .divide(SizedBox(width: 33.rpx))
// .addToStart(SizedBox(width: 37.rpx)),
// ),
// ]
// .addToStart(SizedBox(height: 36.rpx))
// .addToEnd(SizedBox(height: 36.rpx)),
// ),
// ),
// Flexible(
// flex: 3,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Row(
// children: [
// Column(
// crossAxisAlignment:
// CrossAxisAlignment.end,
// children: [
// Text(
// '实时体征.设备ID'.tr,
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc4,
// ),
// ),
// Text(
// '实时体征.体重'.tr,
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc4,
// ),
// ),
// ].divide(SizedBox(height: 34.rpx)),
// ),
// Expanded(
// child: Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Text(
// '${device['code'] ?? '未知数据'.tr}',
// // "D11250300003",
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc3,
// ),
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// ),
// Text(
// '${device['person']?['weight'] ?? '未知数据'.tr}kg',
// style:
// FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController
// .currentColor.sc3,
// ),
// ),
// ].divide(SizedBox(height: 34.rpx)),
// ),
// ),
// ]
// .divide(SizedBox(width: 33.rpx))
// .addToStart(SizedBox(width: 37.rpx)),
// ),
// ]
// .addToStart(SizedBox(height: 36.rpx))
// .addToEnd(SizedBox(height: 36.rpx)),
// ),
// ),
// ],
// ),
// ),
// ),
// Expanded(
// child: SingleChildScrollView(
// child: Column(
// children: [
// Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 66.rpx, 0, 66.rpx, 0),
// child: Container(
// // decoration: BoxDecoration(
// // image: DecorationImage(
// // image: AssetImage(
// // onlineState == "离线".tr
// // ? 'assets/img/black_body_still.png' // 静态图
// // : 'assets/img/body_black.gif', // 动图
// // ),
// // fit: BoxFit.cover,
// // ),
// // ),
// child: Column(
// children: [
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// DeviceStatusInfoWidget(
// title: "在离床".tr,
// iconAsset:
// "assets/img/icon/bed_status.svg",
// value: inBed,
// ),
// DeviceStatusInfoWidget(
// title: "体动".tr,
// iconAsset:
// "assets/img/icon/bodymotion.svg",
// value: (bodyMotion == null ||
// bodyMotion == -1)
// ? "未知数据".tr
// : "$bodyMotion",
// ),
// ],
// ),
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// DeviceStatusInfoWidget(
// title: "心率".tr,
// iconAsset:
// "assets/img/icon/heart.svg",
// value: (heartrate == null ||
// heartrate == -1)
// ? "未知数据".tr
// : "$heartrate",
// ),
// DeviceStatusInfoWidget(
// title: "打鼾".tr,
// iconAsset:
// "assets/img/icon/snore.svg",
// value: '${snores}'.tr,
// ),
// ],
// ),
// Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
// children: [
// DeviceStatusInfoWidget(
// title: "呼吸".tr,
// iconAsset:
// "assets/img/icon/breathe.svg",
// value: (breathrate == null ||
// breathrate == -1)
// ? "未知数据".tr
// : "$breathrate",
// ),
// DeviceStatusInfoWidget(
// title: "呼吸暂停".tr,
// iconAsset:
// "assets/img/icon/breathe_pause.svg",
// value: '${breathState}',
// ),
// ],
// ),
// ].divide(SizedBox(height: 49.rpx)),
// ),
// ),
// ),
// Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 0.rpx, 67.rpx, 0.rpx, 0.rpx),
// child: Container(
// height: 40.rpx,
// child: Text(
// bodyMotion >= maxBodyMotion ? '请保持静止'.tr : "",
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// fontSize: 26.rpx,
// letterSpacing: 0.0,
// color: themeController.currentColor.sc9,
// ),
// ),
// ),
// ),
// // SizedBox(
// // height: 207.rpx,
// // ),
// ],
// ),
// )),
// ClickableContainer(
// backgroundColor: Colors.transparent, // 可自定义背景色
// highlightColor: Colors.white, // 点击涟漪颜色
// borderRadius: 16.rpx, // 圆角大小,可按需调整
// padding: EdgeInsetsDirectional.fromSTEB(
// 30.rpx, 0.rpx, 30.rpx, 0.rpx),
// onTap: () {},
// child: Container(
// padding: EdgeInsetsDirectional.fromSTEB(
// 26.rpx, 26.rpx, 26.rpx, 26.rpx),
// decoration: BoxDecoration(
// // color: FlutterFlowTheme.of(context)
// // .primaryBackground
// // .withOpacity(0.6), // 半透明背景
// borderRadius: BorderRadius.circular(16.rpx),
// border: Border.all(
// color: themeController.currentColor.sc4
// .withOpacity(0.5),
// width: 0.5.rpx,
// ),
// ),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Padding(
// padding: EdgeInsetsDirectional.fromSTEB(
// 0, 8.rpx, 0, 0),
// child: Container(
// width: 23.rpx,
// height: 23.rpx,
// // width: double.infinity,
// decoration: BoxDecoration(),
// child: SvgPicture.asset(
// 'assets/img/icon/tips.svg',
// fit: BoxFit.cover,
// color: themeController.currentColor.sc4,
// ),
// ),
// ),
// Expanded(
// child: Text(
// '实时体征.提示'.tr,
// style: FlutterFlowTheme.of(context)
// .bodyMedium
// .override(
// fontFamily: 'Inter',
// letterSpacing: 0.0,
// color: themeController.currentColor.sc4,
// ),
// ),
// ),
// ].divide(SizedBox(width: 23.rpx)),
// ),
// ),
// ),
// SizedBox(
// height: 26.rpx,
// ),
// ],
// ),
// ),
// ),
child: Stack(
children: [
// 背景图只占一半高度
// Align(
// alignment: Alignment.center,
// child: SizedBox(
// height: 1000.rpx, // 你可以根据需要调整图片最大高度
// width: 1000.rpx, // 或设置 double.infinity 占满宽度
// child: Image.asset(
// (onlineState == "离线".tr || inBed == '离床'.tr)
// ? 'assets/img/black_body_still.png'
// : 'assets/img/body_black.gif',
// fit: BoxFit.contain, // 保持原始比例,不拉伸
// ),
// ),
// ),
Align(
alignment: Alignment.center,
child: FractionallySizedBox(
heightFactor: 0.5,
widthFactor: 0.5,
child: Opacity(
opacity: 0.7,
child: (onlineState == "离线".tr || inBed == '离床'.tr)
? Image.asset(
'assets/img/black_body_still.png',
fit: BoxFit.contain,
)
: SpeedControlledGif(
'assets/img/body_black.gif',
speedFactor:
2, // 2.0 for 2x speed, 0.5 for half speed
fit: BoxFit.contain,
),
),
),
),
// 其余内容放在上层
Positioned.fill(
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 29.rpx, 0.rpx, 0.rpx),
@@ -195,8 +603,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
30.rpx, 0.rpx, 30.rpx, 120.rpx),
child: ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
highlightColor:
themeController.currentColor.sc5, // 或你希望的点击水波纹颜色
highlightColor: themeController
.currentColor.sc5, // 或你希望的点击水波纹颜色
borderRadius: AppConstants()
.normal_container_radius, // 如果你想加圆角可以设置 eg. 12.rpx
padding: EdgeInsets.zero,
@@ -209,7 +617,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
Flexible(
flex: 2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
@@ -219,8 +628,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
children: [
Text(
'实时体征.姓名'.tr,
style:
FlutterFlowTheme.of(context)
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
@@ -232,8 +641,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
),
Text(
'实时体征.年龄'.tr,
style:
FlutterFlowTheme.of(context)
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
@@ -243,7 +652,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
.currentColor.sc4,
),
),
].divide(SizedBox(height: 34.rpx)),
].divide(
SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
@@ -251,8 +661,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
children: [
Text(
'${device['person']?['name'] ?? '未命名'.tr}',
style:
FlutterFlowTheme.of(context)
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
@@ -264,8 +674,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
),
Text(
'${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(device['person']?['birthday'])) ?? '未知数据'.tr}',
style:
FlutterFlowTheme.of(context)
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
@@ -275,11 +685,13 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
].divide(
SizedBox(height: 34.rpx)),
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(SizedBox(width: 37.rpx)),
.addToStart(
SizedBox(width: 37.rpx)),
),
]
.addToStart(SizedBox(height: 36.rpx))
@@ -289,7 +701,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
Flexible(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
@@ -299,8 +712,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
children: [
Text(
'实时体征.设备ID'.tr,
style:
FlutterFlowTheme.of(context)
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
@@ -312,8 +725,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
),
Text(
'实时体征.体重'.tr,
style:
FlutterFlowTheme.of(context)
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
@@ -323,7 +736,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
.currentColor.sc4,
),
),
].divide(SizedBox(height: 34.rpx)),
].divide(
SizedBox(height: 34.rpx)),
),
Expanded(
child: Column(
@@ -333,8 +747,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
Text(
'${device['code'] ?? '未知数据'.tr}',
// "D11250300003",
style:
FlutterFlowTheme.of(context)
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
@@ -344,12 +758,13 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
.currentColor.sc3,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
overflow:
TextOverflow.ellipsis,
),
Text(
'${device['person']?['weight'] ?? '未知数据'.tr}kg',
style:
FlutterFlowTheme.of(context)
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
@@ -359,12 +774,14 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
].divide(
SizedBox(height: 34.rpx)),
),
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(SizedBox(width: 37.rpx)),
.addToStart(
SizedBox(width: 37.rpx)),
),
]
.addToStart(SizedBox(height: 36.rpx))
@@ -468,14 +885,17 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
child: Container(
height: 40.rpx,
child: Text(
bodyMotion >= maxBodyMotion ? '请保持静止'.tr : "",
bodyMotion >= maxBodyMotion
? '请保持静止'.tr
: "",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc9,
color: themeController
.currentColor.sc9,
),
),
),
@@ -533,7 +953,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
color: themeController
.currentColor.sc4,
),
),
),
@@ -548,6 +969,8 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
),
),
),
],
),
),
),
),
@@ -555,3 +978,88 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
);
}
}
class SpeedControlledGif extends StatefulWidget {
final String assetPath;
final double speedFactor;
final BoxFit? fit;
/// [speedFactor] 播放速度倍数默认1.0
/// 大于1表示加速播放小于1表示减速播放
const SpeedControlledGif(
this.assetPath, {
Key? key,
this.speedFactor = 1.0,
this.fit,
}) : super(key: key);
@override
_SpeedControlledGifState createState() => _SpeedControlledGifState();
}
class _SpeedControlledGifState extends State<SpeedControlledGif> {
ui.Codec? _codec;
ui.FrameInfo? _currentFrame;
Timer? _timer;
bool _isDisposed = false;
@override
void initState() {
super.initState();
_loadGif();
}
Future<void> _loadGif() async {
final data = await rootBundle.load(widget.assetPath);
_codec = await ui.instantiateImageCodec(data.buffer.asUint8List());
if (_isDisposed) return;
_showNextFrame();
}
Future<void> _showNextFrame() async {
if (_isDisposed || _codec == null) return;
_currentFrame = await _codec!.getNextFrame();
if (_isDisposed) return;
if (mounted) {
setState(() {});
}
// 取当前帧持续时间,单位毫秒
final baseDuration = _currentFrame?.duration.inMilliseconds ?? 100;
// 限制最小帧间隔,防止刷新过快
const minFrameDuration = 50;
// 计算实际播放帧间隔speedFactor越大速度越快
final adjustedDuration = (baseDuration / widget.speedFactor)
.round()
.clamp(minFrameDuration, 10000);
_timer = Timer(Duration(milliseconds: adjustedDuration), _showNextFrame);
}
@override
void dispose() {
_isDisposed = true;
_timer?.cancel();
_codec?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (_currentFrame == null) {
// 加载中或无帧时显示空容器或占位
return Container();
}
return RawImage(
image: _currentFrame!.image,
fit: widget.fit,
);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,907 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.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/color/app_uri_status.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/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/SelectableTagButton.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/pages/person/select_time.dart';
class AfterUpdatePersonPage extends StatefulWidget {
AfterUpdatePersonPage({super.key});
@override
State<AfterUpdatePersonPage> createState() => _AfterUpdatePersonPageState();
}
class _AfterUpdatePersonPageState extends State<AfterUpdatePersonPage> {
GlobalController globalController = Get.find();
UserInfoController userInfoController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
PersonController personController = Get.find();
BodyDeviceController bodyDeviceController = Get.find();
ThemeController themeController = Get.find();
@override
void initState() {
super.initState();
// personController.dateTime = null;
personController.getDiseaseData().then((apiResponse) {
if (apiResponse.code != HttpStatusCodes.ok) {
TopSlideNotification.show(
context,
text: apiResponse.msg ?? '',
textColor: themeController.currentColor.sc9,
);
}
});
}
@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, // 填满整个 Container
),
),
child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行
appBar: AppBar(
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
iconTheme: IconThemeData(
color: themeController.currentColor.sc3,
),
titleSpacing: 0,
// leading: returnIconButtom,
title: Container(
width: double.infinity,
height: 180.rpx,
child: Stack(
alignment: Alignment.center,
children: [
/// 居中标题
Text(
'人员资料.标题'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Readex Pro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
),
),
/// 左边返回按钮
Positioned(
left: 0,
child: returnIconButtomAddCallback(() {
bodyDeviceController.getDeviceList();
bodyDeviceController.updateAll();
}),
),
Positioned(
right: 20.rpx,
child: CustomCard(
borderRadius: 20.rpx,
onTap: () async {
ApiResponse apiRespons =
await personController.savePersonData();
if (apiRespons.code == HttpStatusCodes.ok) {
updateDeviceBindStatus(
personController.update_person_mac.value);
TopSlideNotification.show(context,
text: apiRespons.msg!);
List device_bind_process =
userInfoController.device_bind_status;
String mac =
personController.update_person_mac.value;
device_bind_process.removeWhere(
(element) => element['mac'] == mac);
await Get.offNamed("/bindDeviceSuccess");
} else {
TopSlideNotification.show(context,
text: apiRespons.msg!,
textColor: themeController.currentColor.sc9);
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: 140.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 0, 16.rpx, 0),
child: Text(
'下一步'.tr,
style: FlutterFlowTheme.of(context)
.titleSmall
.override(
fontFamily: 'Inter Tight',
color: themeController.currentColor.sc3,
letterSpacing: 0.0,
),
),
),
),
),
],
),
),
actions: [],
centerTitle: false,
),
body: SafeArea(
top: true,
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 0, 30.rpx, 0),
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 141.rpx, 70.rpx, 0),
child: Container(
width: double.infinity,
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: TextFormField(
// controller: _model.textController1,
// focusNode: _model.textFieldFocusNode1,
initialValue: personController.name.value,
onChanged: (Value) {
personController.name.value = Value;
},
autofocus: false,
obscureText: false,
decoration: InputDecoration(
fillColor: Colors.transparent,
isDense: true,
labelStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
hintText: '人员资料.名字输入提示'.tr,
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
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: FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
filled: true,
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color:
themeController.currentColor.sc3,
),
textAlign: TextAlign.center,
cursorColor:
themeController.currentColor.sc3,
// validator: _model.textController1Validator
// .asValidator(context),
),
),
),
),
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 90.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Obx(
() {
bool isMaleGreyed =
personController.gender.value ==
0; // gender == 0 时男生部分变灰
return GestureDetector(
onTap: () {
personController.gender.value =
1; // 点击时将 gender 设置为 1女生部分被选中
},
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 90.rpx,
height: 90.rpx,
child: ClipOval(
child: Opacity(
opacity: isMaleGreyed
? 0.4
: 1.0, // 控制透明度
child: Image.asset(
"assets/img/man.png",
fit: BoxFit.cover,
),
),
),
),
Text(
''.tr,
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: isMaleGreyed
? themeController
.currentColor
.sc4
: themeController
.currentColor
.sc3,
),
),
].divide(
SizedBox(height: 14.rpx)),
),
);
},
),
// 女性部分
Obx(
() {
bool isFemaleGreyed =
personController.gender.value ==
1; // gender == 1 时女生部分变灰
return GestureDetector(
onTap: () {
personController.gender.value =
0; // 点击时将 gender 设置为 0男生部分被选中
},
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 90.rpx,
height: 90.rpx,
child: ClipOval(
child: Opacity(
opacity: isFemaleGreyed
? 0.4
: 1.0, // 控制透明度
child: Image.asset(
"assets/img/man.png",
fit: BoxFit.cover,
),
),
),
),
Text(
''.tr,
style: FlutterFlowTheme.of(
context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: isFemaleGreyed
? themeController
.currentColor
.sc4
: themeController
.currentColor
.sc3,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
),
].divide(
SizedBox(height: 14.rpx)),
),
);
},
),
].divide(SizedBox(width: 170.rpx)),
),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 50.rpx, 70.rpx, 0),
child: Container(
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(FocusNode());
Future.delayed(Duration(milliseconds: 250),
() {
showDateSelectionDialog(
context,
checkDate: personController.dateTime ??
DateTime.now(),
checkChange: (DateTime d) {
personController.birthday.value =
MyUtils.formatBindTime(d);
personController.dateTime = d;
personController.updateAll();
},
title: "生日".tr,
);
});
},
child: Center(
child: Text(
personController.dateTime != null
? DateFormat("yyyy年MM月dd日").format(
personController.dateTime!)
: '人员资料.生日输入提示'.tr,
textAlign: TextAlign.right,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: personController.dateTime !=
null
? themeController
.currentColor.sc3
: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
letterSpacing: 0,
),
),
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 18.rpx, 70.rpx, 0),
child: Container(
width: double.infinity,
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Stack(
alignment: Alignment.center,
children: [
TextFormField(
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter
.digitsOnly,
],
initialValue: personController
.height.value
.toString(),
onChanged: (value) {
personController.height.value = value;
},
autofocus: false,
obscureText: false,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color:
Colors.transparent, // 隐藏输入文字
letterSpacing: 0.0,
),
textAlign: TextAlign.center,
cursorColor:
themeController.currentColor.sc3,
decoration: InputDecoration(
fillColor: Colors.transparent,
isDense: true,
hintText: '身高输入提示'.tr,
hintStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
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:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
filled: true,
),
),
Obx(() {
final height =
personController.height.value;
return (height == null ||
height.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${height}cm',
textAlign: TextAlign.center,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
),
);
}),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 18.rpx, 70.rpx, 0),
child: Container(
width: double.infinity,
height: 100.rpx,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Stack(
alignment: Alignment.center,
children: [
// 实际输入框(输入逻辑保留)
TextFormField(
keyboardType: TextInputType.number,
inputFormatters: [
FilteringTextInputFormatter
.digitsOnly,
],
initialValue: personController
.weight.value
.toString(),
onChanged: (value) {
personController.weight.value = value;
},
autofocus: false,
obscureText: false,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color:
Colors.transparent, // 隐藏输入文字
letterSpacing: 0.0,
),
textAlign: TextAlign.center,
cursorColor:
themeController.currentColor.sc3,
decoration: InputDecoration(
fillColor: Colors.transparent,
isDense: true,
hintText: '人员资料.体重输入提示'.tr,
hintStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc4,
fontSize: AppConstants()
.normal_text_fontSize,
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:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedErrorBorder:
OutlineInputBorder(
borderSide: BorderSide(
color:
FlutterFlowTheme.of(context)
.error,
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
filled: true,
),
),
Obx(() {
final weight =
personController.weight?.value;
return (weight == null ||
weight.isEmpty)
? const SizedBox.shrink() // 不显示任何内容
: Text(
'${weight}kg',
textAlign: TextAlign.center,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController
.currentColor.sc3,
fontSize: AppConstants()
.normal_text_fontSize,
),
);
}),
],
),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 117.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
child: Align(
alignment: AlignmentDirectional(0, 0),
child: Text(
'人员资料.疾病标题'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: Color(0xFFF3F4F5),
fontSize: 30.rpx,
letterSpacing: 0.0,
),
),
),
),
),
Obx(() {
final selectedIds =
personController.selectedDiseaseIds;
final diseases = personController.diseaseList;
return Padding(
padding: EdgeInsetsDirectional.fromSTEB(
70.rpx, 70.rpx, 70.rpx, 0),
child: Wrap(
spacing: 20.rpx,
runSpacing: 20.rpx,
children: diseases.map<Widget>((disease) {
final id = disease['_id'];
final name = disease['disease_type_name'];
final isSelected = selectedIds.contains(id);
return SelectableTagButton(
label: name,
selected: isSelected,
onTap: () {
if (isSelected) {
selectedIds.remove(id);
} else {
selectedIds.add(id);
}
personController.model.read = 0;
personController.updateAll();
//切换语言
// Get.updateLocale(Locale("en", "us"));
},
);
}).toList(),
),
);
}),
],
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 52.rpx, 0, 0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: AppConstants().border_width,
),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 30.rpx, 30.rpx, 30.rpx),
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 8.rpx, 0, 0),
child: Container(
width: 23.rpx,
height: 23.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/tips.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
),
),
),
Expanded(
child: Text(
'人员资料.提示'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
color: themeController.currentColor.sc4,
fontSize: 26.rpx,
letterSpacing: 0.0,
),
),
),
].divide(SizedBox(width: 23.rpx)),
),
),
),
),
SizedBox(
height: 20.rpx,
),
],
),
),
),
),
),
),
);
}
Widget _buildDeviceCard(BuildContext context,
{required String title, required String imageUrl, required String type}) {
return CustomCard(
borderRadius: 20.rpx, // 圆角大小
onTap: () {
if (type != null) {
if (type == '1') {
Get.toNamed("/blueteethDevice");
}
}
},
colors: [themeController.currentColor.sc17], // 背景色
child: Container(
width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.135,
constraints: BoxConstraints(
minHeight: 220.rpx,
),
padding: EdgeInsetsDirectional.fromSTEB(77.rpx, 0, 21.rpx, 0),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
color: const Color(0xFFC2CED7),
fontSize: 30.rpx,
letterSpacing: 0.0,
),
),
ClipRRect(
borderRadius: BorderRadius.circular(8.rpx),
child: Image.asset(
imageUrl,
width: 212.rpx,
height: 168.rpx,
),
),
],
),
),
);
}
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": res.data['celibration'],
"person_info": true,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,9 +3,11 @@ import 'package:easydevice/easydevice.dart';
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/app_uri_status.dart';
import 'package:vbvs_app/common/util/DailyLogUtils.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/requestWithLog.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
@@ -89,12 +91,12 @@ class _SingleBlueteethDeviceCompoentWidgetState
await blueteethBindController.bindDeviceAndMAC(device);
TopSlideNotification.show(context, text: response.msg!);
if (response.code == HttpStatusCodes.ok) {
//更新设备绑定流程
updateDeviceBindStatus(device);
Get.toNamed("/wifiPage");
THapp bledevice = THapp(device: widget.bleDevice.device);
blueteethBindController.currentDevice = bledevice;
// blueteethBindController.currentDeviceMac.value = "";
} else {
blueteethBindController.currentDeviceMac.value = "";
blueteethBindController.updateAll();
@@ -252,4 +254,30 @@ class _SingleBlueteethDeviceCompoentWidgetState
),
);
}
//更新设备绑定状态
void updateDeviceBindStatus(BleDeviceData device) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String mac = device.mac!;
String type = "device_bind_status_${mac}";
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}";
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": false,
"celibration": false,
"person_info": false,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新用户绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
}
}

View File

@@ -437,33 +437,34 @@ void showConfirmDialog(
mainAxisSize: MainAxisSize.min,
children: [
// 标题
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ClickableContainer(
backgroundColor: Colors.transparent, // 容器背景色
highlightColor:
themeController.currentColor.sc21, // 点击时的背景色
padding: EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围
onTap: () {
Get.back();
onCancel();
},
child: Padding(
// padding:
// EdgeInsetsDirectional.fromSTEB(0, 33.rpx, 0, 0.rpx),
padding: EdgeInsetsDirectional.fromSTEB(
33.rpx, 33.rpx, 33.rpx, 33.rpx),
child: SvgPicture.asset(
'assets/img/icon/close.svg',
width: 25.rpx,
height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
color: themeController.currentColor.sc3,
),
),
),
],
),
// Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: [
// ClickableContainer(
// backgroundColor: Colors.transparent, // 容器背景色
// highlightColor:
// themeController.currentColor.sc21, // 点击时的背景色
// padding: EdgeInsets.zero, // 这里去掉外部的 padding避免影响点击范围
// onTap: () {
// Get.back();
// onCancel();
// },
// child: Padding(
// // padding:
// // EdgeInsetsDirectional.fromSTEB(0, 33.rpx, 0, 0.rpx),
// padding: EdgeInsetsDirectional.fromSTEB(
// 33.rpx, 33.rpx, 33.rpx, 33.rpx),
// child: SvgPicture.asset(
// 'assets/img/icon/close.svg',
// width: 25.rpx,
// height: 25.rpx, // 如果 SVG 中没有固定颜色,使用 color 设置
// color: themeController.currentColor.sc3,
// ),
// ),
// ),
// ],
// ),
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
@@ -892,8 +893,8 @@ Future<void> showTipDialog(
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0.rpx, 93.rpx, 0, 74.rpx),
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 93.rpx, 0, 74.rpx),
child: widget,
),
),
@@ -926,8 +927,142 @@ Future<void> showTipDialog(
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize:
AppConstants().normal_text_fontSize,
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
),
],
),
),
),
);
},
);
}
Future<void> showUnBindTipDialog(
BuildContext context,
Widget widget, {
Color? backgroundColor,
VoidCallback? onConfirm, // “继续”按钮回调
VoidCallback? onCancel, // “下次再说”按钮回调
}) {
ThemeController themeController = Get.find();
BlueteethBindController blueteethBindController = Get.find();
return showDialog(
context: context,
barrierDismissible: true,
barrierColor: Colors.black.withOpacity(0.5),
builder: (BuildContext context) {
return FrostedDialog(
blurSigma: 3.0,
child: Container(
decoration: BoxDecoration(
color: backgroundColor ?? themeController.currentColor.sc17,
borderRadius: BorderRadius.circular(20.0),
),
padding: EdgeInsetsDirectional.fromSTEB(64.rpx, 0, 64.rpx, 0),
child: Container(
width: double.infinity,
constraints: BoxConstraints(
maxHeight: MediaQuery.sizeOf(context).height * 0.656,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: AlignmentDirectional(0, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 93.rpx, 0, 30.rpx),
child: widget,
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 10.rpx),
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back(); // 关闭对话框
if (onConfirm != null) {
onConfirm(); // 调用确认回调
}
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width,
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, 19.rpx, 0, 60.rpx),
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.back(); // 关闭对话框
if (onCancel != null) {
onCancel(); // 调用取消回调
}
},
colors: [Colors.transparent],
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.055,
decoration: BoxDecoration(
border: Border.all(
color: Colors.white,
width: 0.5.rpx,
),
borderRadius: BorderRadius.circular(
AppConstants().button_container_radius),
),
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,
),
),

View File

@@ -156,11 +156,11 @@ class _CalibrationPageState extends State<CalibrationPage> {
themeController.currentColor.sc2,
],
child: Container(
width: 130.rpx,
width: 140.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0, 0.rpx, 0),
16.rpx, 0, 16.rpx, 0),
child: Text(
'下一步'.tr,
style: TextStyle(
@@ -959,6 +959,8 @@ class _CalibrationPageState extends State<CalibrationPage> {
deviceCalibrationController.flag.value = 2;
progressNotifier.value = 0; // 重置进度条
failureNotifier.value = false; // 重置失败状态
updateDeviceBindStatus(
blueteethBindController.currentDeviceMac!.value);
}
},
onFailure: (res) {
@@ -1022,4 +1024,39 @@ class _CalibrationPageState extends State<CalibrationPage> {
return Container();
}
//更新设备绑定状态
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": true,
"person_info": false,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
}

View File

@@ -149,7 +149,7 @@ class _CalibrationPageState extends State<CalibrationPage> {
themeController.currentColor.sc2,
],
child: Container(
width: 130.rpx,
width: 140.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(

View File

@@ -953,6 +953,8 @@ class _CalibrationPersonPageState extends State<CalibrationPersonPage> {
deviceCalibrationController.flag.value = 0; // 重置标志允许再次点击
} else if (isSecondStep && per >= 100 && currStep == 5 && status) {
// 第二步完成
updateDeviceBindStatus(
blueteethBindController.currentDeviceMac!.value);
_pollingTimer?.cancel();
TopSlideNotification.show(context, text: "设备校准完成".tr);
deviceCalibrationController.bed_calibration.value = 1;
@@ -1024,4 +1026,38 @@ class _CalibrationPersonPageState extends State<CalibrationPersonPage> {
return Container();
}
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": true,
"person_info": res.data['person_info'],
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
}

View File

@@ -6,9 +6,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_svg/svg.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/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -75,6 +77,8 @@ class _WifiPageState extends State<WifiPage> {
blueteethBindController.netType.value = 2;
blueteethBindController.connectStatus.value = 1;
blueteethBindController.updateAll();
updateDeviceBindStatus(
blueteethBindController.currentDeviceMac!.value);
Future.delayed(const Duration(seconds: 1), () {
Get.toNamed("/calibrationPage", arguments: 1);
});
@@ -224,11 +228,11 @@ class _WifiPageState extends State<WifiPage> {
themeController.currentColor.sc2,
],
child: Container(
width: 130.rpx,
width: 140.rpx,
height: 60.rpx,
alignment: Alignment.center,
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0, 0.rpx, 0),
16.rpx, 0, 16.rpx, 0),
child: Text(
'下一步'.tr,
style: FlutterFlowTheme.of(context)
@@ -618,6 +622,10 @@ class _WifiPageState extends State<WifiPage> {
? 1
: 0;
if (wifiStatus) {
updateDeviceBindStatus(
blueteethBindController
.currentDeviceMac!
.value);
// Navigator.pop(context);
TopSlideNotification
.show(
@@ -749,6 +757,9 @@ class _WifiPageState extends State<WifiPage> {
blueteethBindController
.connectStatus.value = 1;
blueteethBindController.updateAll();
updateDeviceBindStatus(
blueteethBindController
.currentDeviceMac!.value);
Future.delayed(
const Duration(seconds: 1), () {
Get.toNamed("/calibrationPage",
@@ -843,6 +854,7 @@ class _WifiPageState extends State<WifiPage> {
await getDeviceWifiStatus(blueteethBindController.currentDevice!, 1);
if (aa != null && aa is Map) {
wifiStatus = true;
updateDeviceBindStatus(blueteethBindController.currentDeviceMac!.value);
blueteethBindController.connect_wifi.value = aa;
} else {
wifiStatus = false;
@@ -1090,6 +1102,7 @@ class _WifiPageState extends State<WifiPage> {
// text: "4g设备配置wifi提示".tr,
// textColor: themeController.currentColor.sc9,
// );
updateDeviceBindStatus(blueteethBindController.currentDeviceMac!.value);
WidgetsBinding.instance.addPostFrameCallback((_) {
TopSlideNotification.show(
context,
@@ -1148,4 +1161,38 @@ class _WifiPageState extends State<WifiPage> {
await FlutterBluePlus.stopScan();
}
}
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": true,
"celibration":res.data['celibration'],
"person_info":res.data['person_info'],
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
}

View File

@@ -6,9 +6,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_blue_plus/flutter_blue_plus.dart';
import 'package:flutter_svg/svg.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/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -563,6 +565,10 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
? 1
: 0;
if (wifiStatus) {
updateDeviceBindStatus(
blueteethBindController
.currentDeviceMac!
.value);
// Navigator.pop(context);
TopSlideNotification
.show(
@@ -702,6 +708,9 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
.currentDevice!,
1);
if (aa == "4g") {
updateDeviceBindStatus(
blueteethBindController
.currentDeviceMac!.value);
TopSlideNotification.show(
context,
text: "4g设备配置wifi提示".tr,
@@ -793,6 +802,7 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
var aa =
await getDeviceWifiStatus(blueteethBindController.currentDevice!, 0);
if (aa != null && aa is Map) {
updateDeviceBindStatus(blueteethBindController.currentDeviceMac!.value);
wifiStatus = true;
blueteethBindController.connect_wifi.value = aa;
} else {
@@ -994,6 +1004,8 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
// );
blueteethBindController.netType.value = 2;
blueteethBindController.updateAll();
updateDeviceBindStatus(
blueteethBindController.currentDeviceMac!.value);
// WidgetsBinding.instance.addPostFrameCallback((_) {
// TopSlideNotification.show(
// context,
@@ -1094,4 +1106,39 @@ class _WifiPagePersonState extends State<WifiPagePerson> {
],
));
}
//更新设备绑定状态
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": true,
"celibration":res.data['celibration'],
"person_info":res.data['person_info'],
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
}

View File

@@ -497,7 +497,7 @@ class _NewHomePageState extends State<NewHomePage> {
Alignment
.center,
child: Text(
'${day['scoreType'] ?? "暂无"}',
'${day['scoreType'] ?? "暂无".tr}',
style: FlutterFlowTheme.of(
context)
.bodyMedium

View File

@@ -19,6 +19,7 @@ import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/time/countdown_controller.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/main.dart';
import 'package:vbvs_app/model/api_response.dart';
class OtherLoginPage extends StatefulWidget {
@@ -337,7 +338,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
alignment: AlignmentDirectional(-1, 0),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 19.rpx, 0, 0),
0, 26.rpx, 0, 0),
child: Container(
height: bodysize.maxHeight * 0.056,
width: double.infinity,
@@ -476,7 +477,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 50.rpx,
height: 30.rpx,
child: VerticalDivider(
thickness: 2.rpx,
color: themeController
@@ -594,7 +595,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 35.rpx, 0, 0),
0, 26.rpx, 0, 0),
child: CustomCard(
borderRadius: AppConstants()
.button_container_radius, // 圆角半径
@@ -623,6 +624,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.currentColor.sc9,
);
} else {
// await dealBindProcess();
CountdownController
countdownController = Get.find();
countdownController.countdown.value =
@@ -685,7 +687,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
25.rpx, 83.rpx, 25.rpx, 50.rpx),
25.rpx, 42.rpx, 25.rpx, 50.rpx),
child: Container(
width: double.infinity,
decoration: BoxDecoration(),
@@ -760,7 +762,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
fontSize: 26.rpx,
fontSize: 20.rpx,
color: themeController
.currentColor.sc3,
),
@@ -773,7 +775,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
fontSize: 26.rpx,
fontSize: 20.rpx,
color: stringToColor(
"#FF9F66"),
),
@@ -786,7 +788,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
fontSize: 26.rpx,
fontSize: 20.rpx,
color: themeController
.currentColor.sc3,
),
@@ -799,7 +801,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
fontSize: 26.rpx,
fontSize: 20.rpx,
color: stringToColor(
"#FF9F66"),
),
@@ -812,7 +814,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
fontSize: 26.rpx,
fontSize: 20.rpx,
color: themeController
.currentColor.sc3,
),
@@ -825,7 +827,7 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
fontSize: 26.rpx,
fontSize: 20.rpx,
color: stringToColor(
"#FF9F66"),
),

View File

@@ -35,8 +35,8 @@ class _MessageWidgetWidgetState extends State<MessageWidgetWidget> {
return Stack(
children: [
ClickableContainer(
backgroundColor: Color(0xFF003058),
highlightColor: themeController.currentColor.sc3,
backgroundColor: themeController.currentColor.sc5,
highlightColor: themeController.currentColor.sc21,
borderRadius: 20.rpx,
padding:
EdgeInsetsDirectional.fromSTEB(31.rpx, 33.rpx, 0.rpx, 33.rpx),

View File

@@ -17,10 +17,13 @@ import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart';
import 'package:vbvs_app/controller/home/home_controller.dart';
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/controller/user_info_controller.dart';
import 'package:vbvs_app/controller/weather/weather_controller.dart';
import 'package:vbvs_app/enum/LoginStatus.dart';
import 'package:vbvs_app/main.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@@ -164,6 +167,18 @@ class _HomePageState extends State<HomePage> {
_popupEntry = null;
}
@override
void didChangeDependencies() {
super.didChangeDependencies();
// 页面返回时重新判断是否当前路由是HomePage
WidgetsBinding.instance.addPostFrameCallback((_) {
if (ModalRoute.of(context)?.isCurrent ?? false) {
checkAndShowBindProcess();
}
});
}
@override
initState() {
super.initState();
@@ -191,6 +206,152 @@ class _HomePageState extends State<HomePage> {
}
});
}
if (userInfoController.device_bind_flag == 0) {
dealBindProcess().then((value) {
WidgetsBinding.instance.addPostFrameCallback((_) {
userInfoController.device_bind_flag = 1;
checkAndShowBindProcess();
// List device_bind_process = userInfoController.device_bind_status;
// if (device_bind_process != null && device_bind_process.isNotEmpty) {
// int currentIndex = 0;
// void showNextDialog() {
// if (currentIndex >= device_bind_process.length) return;
// String code = device_bind_process[currentIndex]['mac'];
// showUnBindTipDialog(
// context,
// Column(
// children: [
// Text(
// "发现".tr,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc3,
// ),
// ),
// SizedBox(height: 20.rpx),
// Text.rich(
// TextSpan(
// children: [
// TextSpan(
// text: "检测到".tr,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc3,
// ),
// ),
// TextSpan(
// text: code,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc8,
// ),
// ),
// TextSpan(
// text: "绑定流程未走完是否继续?".tr,
// style: TextStyle(
// fontSize: AppConstants().normal_text_fontSize,
// color: themeController.currentColor.sc3,
// ),
// ),
// ],
// ),
// ),
// ],
// ),
// onConfirm: () async {
// print("继续设备:$code");
// var data = device_bind_process[currentIndex];
// BlueteethBindController blueteethBindController = Get.find();
// blueteethBindController.currentDeviceMac?.value = data['mac'];
// PersonController personController = Get.find();
// personController.after_deveice = data['device_info'];
// // 从 WiFi 开始配置
// if (data['wifi'] == false) {
// await Get.toNamed("/afterWifiPagePerson",
// arguments: data['device_info'])!
// .then((_) {
// currentIndex++;
// showNextDialog(); // 👈 返回后继续弹窗流程
// });
// return;
// }
// // 从设备校准开始配置
// if (data['celibration'] == false) {
// await Get.toNamed("/afterCalibrationPersonPage")!.then((_) {
// currentIndex++;
// showNextDialog(); // 👈 返回后继续弹窗流程
// });
// return;
// }
// // 从人员信息配置开始
// if (data['person_info'] == false) {
// if (data['device_info']['person'] != null) {
// personController.currentPersonId.value =
// data['device_info']['_id'];
// personController.name.value =
// data['device_info']['person']['name'];
// personController.update_person_mac.value =
// data['device_info']['mac'];
// personController.gender.value =
// data['device_info']['person']['gender'] ?? 1;
// personController.weight?.value =
// data['device_info']['person']['weight']?.toString() ??
// '';
// personController.height.value =
// data['device_info']['person']['height']?.toString() ??
// '';
// personController.selectedDiseaseIds.value =
// data['device_info']['person']['disease'] ?? [];
// personController.birthday.value =
// data['device_info']['person']['birthday'] ?? '';
// personController.dateTime = MyUtils.formatBirthdayTime(
// data['device_info']['person']['birthday']);
// } else {
// personController.update_person_mac.value =
// data['device_info']['mac'];
// personController.currentPersonId.value =
// data['device_info']['_id'];
// personController.name.value = "";
// personController.gender.value = 1;
// personController.dateTime = null;
// personController.height.value = "";
// personController.weight.value = "";
// personController.diseaseList.value = [];
// }
// await Get.toNamed("/afterUpdatePersonPage")!.then((_) {
// currentIndex++;
// showNextDialog(); // 👈 返回后继续弹窗流程
// });
// return;
// }
// // 如果以上都走完了,继续下一个弹窗
// currentIndex++;
// showNextDialog();
// },
// onCancel: () {
// print("跳过设备:$code");
// device_bind_process.removeAt(currentIndex);
// showNextDialog();
// },
// );
// }
// showNextDialog();
// }
});
});
}
}
@override
@@ -1081,4 +1242,120 @@ class _HomePageState extends State<HomePage> {
),
);
}
void checkAndShowBindProcess() {
UserInfoController userInfoController = Get.find();
List device_bind_process = userInfoController.device_bind_status;
if (device_bind_process != null && device_bind_process.isNotEmpty) {
int currentIndex = 0;
void showNextDialog() {
if (currentIndex >= device_bind_process.length) return;
String code = device_bind_process[currentIndex]['mac'];
showUnBindTipDialog(
context,
Column(
children: [
Text(
"发现".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
SizedBox(height: 20.rpx),
Text.rich(
TextSpan(
children: [
TextSpan(
text: "检测到".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
TextSpan(
text: code,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc8,
),
),
TextSpan(
text: "绑定流程未走完是否继续?".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
],
),
onConfirm: () async {
var data = device_bind_process[currentIndex];
PersonController personController = Get.find();
personController.after_deveice = data['device_info'];
// 判断逻辑...
if (data['wifi'] == false) {
await Get.toNamed("/afterWifiPagePerson",
arguments: data['device_info']);
return;
}
if (data['celibration'] == false) {
await Get.toNamed("/afterCalibrationPersonPage");
return;
}
if (data['person_info'] == false) {
PersonController personController = Get.find();
if (data['device_info']['person'] != null) {
personController.currentPersonId.value =
data['device_info']['_id'];
personController.name.value =
data['device_info']['person']['name'];
personController.update_person_mac.value =
data['device_info']['mac'];
personController.gender.value =
data['device_info']['person']['gender'] ?? 1;
personController.weight?.value =
data['device_info']['person']['weight']?.toString() ?? '';
personController.height.value =
data['device_info']['person']['height']?.toString() ?? '';
personController.selectedDiseaseIds.value =
data['device_info']['person']['disease'] ?? [];
personController.birthday.value =
data['device_info']['person']['birthday'] ?? '';
personController.dateTime = MyUtils.formatBirthdayTime(
data['device_info']['person']['birthday']);
} else {
personController.update_person_mac.value =
data['device_info']['mac'];
personController.currentPersonId.value =
data['device_info']['_id'];
personController.name.value = "";
personController.gender.value = 1;
personController.dateTime = null;
personController.height.value = "";
personController.weight.value = "";
personController.diseaseList.value = [];
}
await Get.toNamed("/afterUpdatePersonPage");
return;
}
currentIndex++;
showNextDialog();
},
onCancel: () {
device_bind_process.removeAt(currentIndex);
showNextDialog();
},
);
}
showNextDialog();
}
}
}

View File

@@ -206,7 +206,7 @@ class _MinePageState extends State<MinePage> {
? (userInfoController.model
.user!.nick_name ??
'未命名'.tr)
: "我的.未登录".tr,
: "未命名".tr,
style:
FlutterFlowTheme.of(context)
.bodyMedium
@@ -240,7 +240,7 @@ class _MinePageState extends State<MinePage> {
return "微信用户".tr;
}
})()
: "我的.未登录".tr,
: "未知数据".tr,
style:
FlutterFlowTheme.of(context)
.bodyMedium
@@ -650,8 +650,12 @@ class _MinePageState extends State<MinePage> {
// themeController.currentColor.sc2,
// );
Get.toNamed("/newSleepReportPage",
arguments: {'date':DateTime.now()
.millisecondsSinceEpoch,"mac":'aaaaaaeeeeeq','type':1});
arguments: {
'date': DateTime.now()
.millisecondsSinceEpoch,
"mac": 'aaaaaaeeeeeq',
'type': 1
});
}
},
child: Container(
@@ -737,5 +741,4 @@ class _MinePageState extends State<MinePage> {
),
);
}
}

View File

@@ -1,11 +1,14 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.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/color/app_uri_status.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/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/SelectableTagButton.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -109,6 +112,7 @@ class _EPageState extends State<PersonPage> {
if (apiRespons.code == HttpStatusCodes.ok) {
TopSlideNotification.show(context,
text: apiRespons.msg!);
updateDeviceBindStatus(blueteethBindController.currentDeviceMac!.value);
Get.offNamed("/bindDeviceSuccess");
} else {
TopSlideNotification.show(context,
@@ -771,10 +775,16 @@ class _EPageState extends State<PersonPage> {
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 8.rpx, 0, 0),
child: Icon(
Icons.arrow_back,
child: Container(
width: 23.rpx,
height: 23.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/tips.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
size: 24.rpx,
),
),
),
Expanded(
@@ -851,3 +861,36 @@ class _EPageState extends State<PersonPage> {
);
}
}
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl = "${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": res.data['celibration'],
"person_info": true,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}

View File

@@ -1,11 +1,14 @@
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_svg/svg.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/color/app_uri_status.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/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/SelectableTagButton.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
@@ -107,6 +110,8 @@ class _UpdatePageState extends State<UpdatePersonPage> {
ApiResponse apiRespons =
await personController.savePersonData();
if (apiRespons.code == HttpStatusCodes.ok) {
updateDeviceBindStatus(
personController.update_person_mac.value);
TopSlideNotification.show(context,
text: apiRespons.msg!);
} else {
@@ -775,10 +780,16 @@ class _UpdatePageState extends State<UpdatePersonPage> {
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 8.rpx, 0, 0),
child: Icon(
Icons.arrow_back,
child: Container(
width: 23.rpx,
height: 23.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/tips.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
size: 24.rpx,
),
),
),
Expanded(
@@ -857,4 +868,38 @@ class _UpdatePageState extends State<UpdatePersonPage> {
),
);
}
void updateDeviceBindStatus(String mac) {
String serviceAddress = ServiceConstant.service_address;
String serviceName = ServiceConstant.server_service;
String serviceApi = ServiceConstant.user_setting;
String type = "device_bind_status_$mac";
String queryUrl =
"${serviceAddress}${serviceName}${serviceApi}?type=${type}";
requestWithLog(
logTitle: "查询绑定流程",
method: MyHttpMethod.get,
queryUrl: queryUrl,
onSuccess: (res) {
print(res);
Map<String, dynamic> data = {
"type": type,
"mac": mac,
"wifi": res.data['wifi'],
"celibration": res.data['celibration'],
"person_info": true,
"time": DateTime.now().millisecondsSinceEpoch,
};
requestWithLog(
logTitle: "更新绑定流程",
method: MyHttpMethod.put,
queryUrl: queryUrl,
data: data,
onSuccess: (res) {},
onFailure: (res) {},
);
},
onFailure: (res) {},
);
}
}

View File

@@ -13,8 +13,6 @@ class AboutUsPage extends StatefulWidget {
}
class _AboutUsPageState extends State<AboutUsPage> {
@override
void initState() {
super.initState();
@@ -110,7 +108,7 @@ class _AboutUsPageState extends State<AboutUsPage> {
body: SafeArea(
top: true,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 30.rpx),
padding: EdgeInsets.symmetric(horizontal: 0.rpx),
child: Column(children: [
Expanded(
child: Container(

View File

@@ -9,6 +9,9 @@ import 'package:vbvs_app/pages/device/device_detail.dart';
import 'package:vbvs_app/pages/device/instant_body_page.dart';
import 'package:vbvs_app/pages/device/message_review_page.dart';
import 'package:vbvs_app/pages/device_bind/MobileScannerTestPage.dart';
import 'package:vbvs_app/pages/device_bind/after/after_device_calibration_person.dart';
import 'package:vbvs_app/pages/device_bind/after/after_update_person_page.dart';
import 'package:vbvs_app/pages/device_bind/after/after_wifi_page_person.dart';
import 'package:vbvs_app/pages/device_bind/bind_device_success.dart';
import 'package:vbvs_app/pages/device_bind/blueteeth_device_page.dart';
import 'package:vbvs_app/pages/device_bind/device_calibration.dart';
@@ -19,9 +22,7 @@ import 'package:vbvs_app/pages/device_bind/device_type.dart';
import 'package:vbvs_app/pages/device_bind/device_type_list.dart';
import 'package:vbvs_app/pages/device_bind/wifi_page.dart';
import 'package:vbvs_app/pages/device_bind/wifi_page_person.dart';
import 'package:vbvs_app/pages/login/login.dart';
import 'package:vbvs_app/pages/login/other_login.dart';
import 'package:vbvs_app/pages/main_bottom/component/main_page_b_bottom_change.dart';
import 'package:vbvs_app/pages/main_bottom/e_page.dart';
import 'package:vbvs_app/pages/main_bottom/follow_page.dart';
import 'package:vbvs_app/pages/main_bottom/help_page.dart';
@@ -79,7 +80,8 @@ var routes = {
"/deviceShareListPage": (contxt, {arguments}) =>
DeviceShareListPage(device: arguments),
"/calibrationPage": (contxt, {arguments}) => CalibrationPage(type: arguments),
"/calibrationPersonPage": (contxt, {arguments}) => CalibrationPersonPage(type: arguments),
"/calibrationPersonPage": (contxt, {arguments}) =>
CalibrationPersonPage(type: arguments),
"/applyRepairPage": (contxt) => ApplyRepairPage(),
"/languageSetting": (contxt) => LanguageSetting(),
"/helpPage": (contxt) => HelpPage(),
@@ -96,8 +98,12 @@ var routes = {
MessageReviewPage(data: arguments),
"/messageSettingPage": (contxt, {arguments}) =>
MessageSettingPage(data: arguments),
"/commonMessageSettingPage": (contxt) =>
CommonMessageSettingPage(),
"/commonMessageSettingPage": (contxt) => CommonMessageSettingPage(),
"/afterCalibrationPersonPage": (contxt) => AfterCalibrationPersonPage(),
"/afterUpdatePersonPage": (contxt) => AfterUpdatePersonPage(),
"/afterWifiPagePerson": (contxt, {arguments}) => AfterWifiPagePerson(
type: arguments,
),
};
var onGenerateRoute = (RouteSettings settings) {

View File

@@ -58,6 +58,7 @@ dependencies:
# fl_chart: ^1.0.0
video_player: ^2.9.5
chewie: ^1.10.0
gif: ^2.3.0
dev_dependencies:
flutter_test: