更新界面布局
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user