|
@@ -163,13 +163,10 @@ class _HeartRateState extends State<HeartRate> {
|
|
|
}
|
|
|
}),
|
|
|
),
|
|
|
- if (showResetButton)
|
|
|
- _buildResetButton()
|
|
|
- else
|
|
|
- // _buildDebugButton()
|
|
|
- const SizedBox(
|
|
|
- height: 48,
|
|
|
- ),
|
|
|
+ Container(
|
|
|
+ // !! 这一层 Container 不能删 ,否则会引发 EcgView 的 controller 被异常删除
|
|
|
+ child: _buildResetButton(),
|
|
|
+ ),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
@@ -183,30 +180,36 @@ class _HeartRateState extends State<HeartRate> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- Widget _buildDebugButton() {
|
|
|
- return Container(
|
|
|
- child: Row(
|
|
|
- children: [
|
|
|
- const Text(
|
|
|
- '测试============?',
|
|
|
- style: TextStyle(color: Colors.grey, fontSize: 24),
|
|
|
- ),
|
|
|
- TextButton(
|
|
|
- onPressed: () {
|
|
|
- debugTest();
|
|
|
- },
|
|
|
- child: const Text(
|
|
|
- '重试',
|
|
|
- style: TextStyle(color: Colors.blue, fontSize: 24),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
+ // Widget _buildDebugButton() {
|
|
|
+ // return Container(
|
|
|
+ // child: Row(
|
|
|
+ // children: [
|
|
|
+ // const Text(
|
|
|
+ // '测试============?',
|
|
|
+ // style: TextStyle(color: Colors.grey, fontSize: 24),
|
|
|
+ // ),
|
|
|
+ // TextButton(
|
|
|
+ // onPressed: () {
|
|
|
+ // debugTest();
|
|
|
+ // },
|
|
|
+ // child: const Text(
|
|
|
+ // '重试',
|
|
|
+ // style: TextStyle(color: Colors.blue, fontSize: 24),
|
|
|
+ // ),
|
|
|
+ // ),
|
|
|
+ // ],
|
|
|
+ // ),
|
|
|
+ // );
|
|
|
+ // }
|
|
|
|
|
|
Widget _buildResetButton() {
|
|
|
+ if (!showResetButton) {
|
|
|
+ return const SizedBox(
|
|
|
+ height: 48,
|
|
|
+ );
|
|
|
+ }
|
|
|
return Container(
|
|
|
+ padding: const EdgeInsets.only(left: 30),
|
|
|
child: Row(
|
|
|
children: [
|
|
|
const Text(
|
|
@@ -285,7 +288,7 @@ class _HeartRateState extends State<HeartRate> {
|
|
|
if (initEcgData != null &&
|
|
|
initEcgData!.isNotEmpty &&
|
|
|
initEcgData!.length < 125 * 30) {
|
|
|
- print("数据不完整 ⭐⭐⭐⭐⭐⭐⭐");
|
|
|
+ // print("数据不完整 ⭐⭐⭐⭐⭐⭐⭐");
|
|
|
showResetButton = true;
|
|
|
}
|
|
|
} else {
|
|
@@ -403,6 +406,7 @@ class _HeartRateState extends State<HeartRate> {
|
|
|
/// 更新心率
|
|
|
void _onHrValueUpdate(_, int e) {
|
|
|
logger.i('心率更新:$e');
|
|
|
+
|
|
|
if (_deviceError.isNotEmpty || _assess.isNotEmpty) {
|
|
|
// 如果上次因错误而停止了,这里需要先重置
|
|
|
_deviceError = '';
|
|
@@ -411,6 +415,7 @@ class _HeartRateState extends State<HeartRate> {
|
|
|
}
|
|
|
setState(() {
|
|
|
_heart = e.toString();
|
|
|
+ showResetButton = false;
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -437,11 +442,17 @@ class _HeartRateState extends State<HeartRate> {
|
|
|
|
|
|
/// 判断数据是否完整
|
|
|
if (ecgPoint.isNotEmpty && ecgPoint.length < 125 * 30) {
|
|
|
- print("数据不完整 ⭐⭐⭐⭐⭐⭐⭐");
|
|
|
+ // print("数据不完整 ⭐⭐⭐⭐⭐⭐⭐");
|
|
|
showResetButton = true;
|
|
|
}
|
|
|
- medicalController.saveCachedRecord();
|
|
|
- print(medicalController.diagnosisDataValue);
|
|
|
+
|
|
|
+ /// FIXME 解除下方注释
|
|
|
+ // try {
|
|
|
+ // medicalController.saveCachedRecord();
|
|
|
+ // } catch (e) {
|
|
|
+ // print(e);
|
|
|
+ // }
|
|
|
+ // print(medicalController.diagnosisDataValue);
|
|
|
setState(() {});
|
|
|
}
|
|
|
|