Showing
5 changed files
with
51 additions
and
91 deletions
| @@ -330,11 +330,27 @@ class _QuestionBottomSheet extends StatelessWidget { | @@ -330,11 +330,27 @@ class _QuestionBottomSheet extends StatelessWidget { | ||
| 330 | SizedBox(height: 8), | 330 | SizedBox(height: 8), |
| 331 | SizedBox( | 331 | SizedBox( |
| 332 | height: 56, | 332 | height: 56, |
| 333 | - child: Stack( | ||
| 334 | - alignment: Alignment.center, | 333 | + child: Row( |
| 334 | + // alignment: Alignment.center, | ||
| 335 | + | ||
| 335 | children: [ | 336 | children: [ |
| 336 | - Padding( | ||
| 337 | - padding: EdgeInsets.symmetric(horizontal: 72), | 337 | + GestureDetector( |
| 338 | + behavior: HitTestBehavior.opaque, | ||
| 339 | + onTap: Get.back, | ||
| 340 | + child: SizedBox( | ||
| 341 | + width: 44, | ||
| 342 | + height: 44, | ||
| 343 | + child: Center( | ||
| 344 | + child: Image.asset( | ||
| 345 | + 'assets/images/common/ic_close.png', | ||
| 346 | + width: 20, | ||
| 347 | + height: 20, | ||
| 348 | + color: context.colors.chartPurple, | ||
| 349 | + ), | ||
| 350 | + ), | ||
| 351 | + ), | ||
| 352 | + ), | ||
| 353 | + Expanded( | ||
| 338 | child: Text( | 354 | child: Text( |
| 339 | item.title, | 355 | item.title, |
| 340 | maxLines: 1, | 356 | maxLines: 1, |
| @@ -348,25 +364,9 @@ class _QuestionBottomSheet extends StatelessWidget { | @@ -348,25 +364,9 @@ class _QuestionBottomSheet extends StatelessWidget { | ||
| 348 | ), | 364 | ), |
| 349 | ), | 365 | ), |
| 350 | ), | 366 | ), |
| 351 | - Positioned( | ||
| 352 | - left: 16, | ||
| 353 | - child: GestureDetector( | ||
| 354 | - behavior: HitTestBehavior.opaque, | ||
| 355 | - onTap: Get.back, | ||
| 356 | - child: SizedBox( | ||
| 357 | - width: 44, | ||
| 358 | - height: 44, | ||
| 359 | - child: Center( | ||
| 360 | - child: Image.asset( | ||
| 361 | - 'assets/images/common/ic_close.png', | ||
| 362 | - width: 20, | ||
| 363 | - height: 20, | ||
| 364 | - color: context.colors.chartPurple, | ||
| 365 | - ), | ||
| 366 | - ), | ||
| 367 | - ), | ||
| 368 | - ), | ||
| 369 | - ), | 367 | + SizedBox( |
| 368 | + width: 44, | ||
| 369 | + ) | ||
| 370 | ], | 370 | ], |
| 371 | ), | 371 | ), |
| 372 | ), | 372 | ), |
| @@ -113,18 +113,6 @@ class TodayController extends GetMaterialController { | @@ -113,18 +113,6 @@ class TodayController extends GetMaterialController { | ||
| 113 | showPartnerAdBanner.value = false; | 113 | showPartnerAdBanner.value = false; |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | - // ── HRV 数字 + 心率 ─────────────────────── | ||
| 117 | - final avgHrv = '--'.obs; | ||
| 118 | - final restingHeartRate = '--'.obs; | ||
| 119 | - | ||
| 120 | - // ── 健身卡片 ────────────────────────────── | ||
| 121 | - final activityCalories = '--'.obs; | ||
| 122 | - final activityExerciseMinutes = '--'.obs; | ||
| 123 | - final activityStandHours = '--'.obs; | ||
| 124 | - final activityMoveProgress = 0.0.obs; | ||
| 125 | - final activityExerciseProgress = 0.0.obs; | ||
| 126 | - final activityStandProgress = 0.0.obs; | ||
| 127 | - | ||
| 128 | // ── HRV 趋势图 ──────────────────────────── | 116 | // ── HRV 趋势图 ──────────────────────────── |
| 129 | final hrvChartData = <V2HrvTrendItem>[].obs; | 117 | final hrvChartData = <V2HrvTrendItem>[].obs; |
| 130 | final stressChartData = <V2RealtimeStressItem>[].obs; | 118 | final stressChartData = <V2RealtimeStressItem>[].obs; |
| @@ -456,18 +444,11 @@ class TodayController extends GetMaterialController { | @@ -456,18 +444,11 @@ class TodayController extends GetMaterialController { | ||
| 456 | } | 444 | } |
| 457 | 445 | ||
| 458 | void _clearRealTimeData() { | 446 | void _clearRealTimeData() { |
| 459 | - restingHeartRate.value = '--'; | ||
| 460 | - | ||
| 461 | - activityCalories.value = '--'; | ||
| 462 | - activityExerciseMinutes.value = '--'; | ||
| 463 | - activityStandHours.value = '--'; | ||
| 464 | - activityMoveProgress.value = 0.0; | ||
| 465 | - activityExerciseProgress.value = 0.0; | ||
| 466 | - activityStandProgress.value = 0.0; | ||
| 467 | hrvChartData.clear(); | 447 | hrvChartData.clear(); |
| 468 | stressChartData.clear(); | 448 | stressChartData.clear(); |
| 469 | hrvAnnotations.clear(); | 449 | hrvAnnotations.clear(); |
| 470 | - avgHrv.value = '--'; | 450 | + |
| 451 | + v2HealthData.value = null; | ||
| 471 | } | 452 | } |
| 472 | 453 | ||
| 473 | toTrendHrvPage() { | 454 | toTrendHrvPage() { |
| @@ -178,18 +178,13 @@ class TodayTabBody extends StatelessWidget { | @@ -178,18 +178,13 @@ class TodayTabBody extends StatelessWidget { | ||
| 178 | ), | 178 | ), |
| 179 | ), | 179 | ), |
| 180 | ), | 180 | ), |
| 181 | - Obx( | ||
| 182 | - () => controller.isLoadingToday.value | ||
| 183 | - ? Lottie.asset( | ||
| 184 | - 'assets/lottie/loading.json', | ||
| 185 | - width: 65, | ||
| 186 | - height: 45, | ||
| 187 | - repeat: true, | ||
| 188 | - animate: true, | ||
| 189 | - ) | ||
| 190 | - : Padding( | ||
| 191 | - padding: const EdgeInsets.only(bottom: 12), | ||
| 192 | - child: Text( | 181 | + Container( |
| 182 | + height: 51, | ||
| 183 | + alignment: Alignment.topCenter, | ||
| 184 | + child: Obx( | ||
| 185 | + () => controller.isLoadingToday.value | ||
| 186 | + ? CircularProgressIndicator(strokeWidth: 2.5) | ||
| 187 | + : Text( | ||
| 193 | controller.v2StressScore.value?.stateString() ?? | 188 | controller.v2StressScore.value?.stateString() ?? |
| 194 | '', | 189 | '', |
| 195 | textAlign: TextAlign.center, | 190 | textAlign: TextAlign.center, |
| @@ -199,7 +194,7 @@ class TodayTabBody extends StatelessWidget { | @@ -199,7 +194,7 @@ class TodayTabBody extends StatelessWidget { | ||
| 199 | fontWeight: FontWeight.w500, | 194 | fontWeight: FontWeight.w500, |
| 200 | ), | 195 | ), |
| 201 | ), | 196 | ), |
| 202 | - ), | 197 | + ), |
| 203 | ), | 198 | ), |
| 204 | Obx( | 199 | Obx( |
| 205 | () => StressProgressBar( | 200 | () => StressProgressBar( |
| @@ -72,13 +72,7 @@ class TodayHrvChartCard extends StatelessWidget { | @@ -72,13 +72,7 @@ class TodayHrvChartCard extends StatelessWidget { | ||
| 72 | ), | 72 | ), |
| 73 | if (controller.isLoadingToday.value) | 73 | if (controller.isLoadingToday.value) |
| 74 | Center( | 74 | Center( |
| 75 | - child: Lottie.asset( | ||
| 76 | - 'assets/lottie/loading.json', | ||
| 77 | - width: 130, | ||
| 78 | - height: 90, | ||
| 79 | - repeat: true, | ||
| 80 | - animate: true, | ||
| 81 | - ), | 75 | + child: CircularProgressIndicator(strokeWidth: 2.5), |
| 82 | ) | 76 | ) |
| 83 | else if (hrvSpots.isEmpty) | 77 | else if (hrvSpots.isEmpty) |
| 84 | _EmptyChart(text: context.l10n.noDataAvailableForToday) | 78 | _EmptyChart(text: context.l10n.noDataAvailableForToday) |
| @@ -264,13 +258,7 @@ class TodayHrvChartCard extends StatelessWidget { | @@ -264,13 +258,7 @@ class TodayHrvChartCard extends StatelessWidget { | ||
| 264 | ), | 258 | ), |
| 265 | if (controller.isLoadingToday.value) | 259 | if (controller.isLoadingToday.value) |
| 266 | Center( | 260 | Center( |
| 267 | - child: Lottie.asset( | ||
| 268 | - 'assets/lottie/loading.json', | ||
| 269 | - width: 130, | ||
| 270 | - height: 90, | ||
| 271 | - repeat: true, | ||
| 272 | - animate: true, | ||
| 273 | - ), | 261 | + child: CircularProgressIndicator(strokeWidth: 2.5), |
| 274 | ) | 262 | ) |
| 275 | else if (stressPoints.isEmpty) | 263 | else if (stressPoints.isEmpty) |
| 276 | _EmptyChart(text: context.l10n.noPressureDataAvailableAtThisTime) | 264 | _EmptyChart(text: context.l10n.noPressureDataAvailableAtThisTime) |
| @@ -65,7 +65,9 @@ class ProgressPainter extends CustomPainter { | @@ -65,7 +65,9 @@ class ProgressPainter extends CustomPainter { | ||
| 65 | var shader = SweepGradient( | 65 | var shader = SweepGradient( |
| 66 | startAngle: startAngle.toRadians(), | 66 | startAngle: startAngle.toRadians(), |
| 67 | endAngle: 360.toRadians(), | 67 | endAngle: 360.toRadians(), |
| 68 | - colors: reverse ? progressColor[colorRangeIndex].reversed.toList() : progressColor[colorRangeIndex], | 68 | + colors: reverse |
| 69 | + ? progressColor[colorRangeIndex].reversed.toList() | ||
| 70 | + : progressColor[colorRangeIndex], | ||
| 69 | ).createShader(rect); | 71 | ).createShader(rect); |
| 70 | 72 | ||
| 71 | var paint = Paint() | 73 | var paint = Paint() |
| @@ -101,7 +103,8 @@ class ProgressPainter extends CustomPainter { | @@ -101,7 +103,8 @@ class ProgressPainter extends CustomPainter { | ||
| 101 | if (sweepAngle > 360) { | 103 | if (sweepAngle > 360) { |
| 102 | rotationAngle = 360 - sweepAngle; | 104 | rotationAngle = 360 - sweepAngle; |
| 103 | } | 105 | } |
| 104 | - double rotationRadians = reverse ? -rotationAngle.toRadians() : rotationAngle.toRadians(); | 106 | + double rotationRadians = |
| 107 | + reverse ? -rotationAngle.toRadians() : rotationAngle.toRadians(); | ||
| 105 | // Rotate the canvas | 108 | // Rotate the canvas |
| 106 | canvas.rotate((-90).toRadians() - rotationRadians); | 109 | canvas.rotate((-90).toRadians() - rotationRadians); |
| 107 | // Move the canvas origin back | 110 | // Move the canvas origin back |
| @@ -123,7 +126,9 @@ class ProgressPainter extends CustomPainter { | @@ -123,7 +126,9 @@ class ProgressPainter extends CustomPainter { | ||
| 123 | canvas.drawArc( | 126 | canvas.drawArc( |
| 124 | rect, | 127 | rect, |
| 125 | 0.toRadians(), | 128 | 0.toRadians(), |
| 126 | - reverse ? -(startAngle + sweepAngle).toRadians() : (startAngle + sweepAngle).toRadians(), | 129 | + reverse |
| 130 | + ? -(startAngle + sweepAngle).toRadians() | ||
| 131 | + : (startAngle + sweepAngle).toRadians(), | ||
| 127 | false, | 132 | false, |
| 128 | paint, | 133 | paint, |
| 129 | ); | 134 | ); |
| @@ -141,7 +146,8 @@ class ProgressPainter extends CustomPainter { | @@ -141,7 +146,8 @@ class ProgressPainter extends CustomPainter { | ||
| 141 | canvas.translate(centerX, centerY); | 146 | canvas.translate(centerX, centerY); |
| 142 | if (sweepAngle < 360) { | 147 | if (sweepAngle < 360) { |
| 143 | final endCapRotate = 360 - sweepAngle; | 148 | final endCapRotate = 360 - sweepAngle; |
| 144 | - canvas.rotate(reverse ? endCapRotate.toRadians() : -endCapRotate.toRadians()); | 149 | + canvas.rotate( |
| 150 | + reverse ? endCapRotate.toRadians() : -endCapRotate.toRadians()); | ||
| 145 | } | 151 | } |
| 146 | //0.1 is because the angle calculation is not accurate enough, so we need to go back a little bit. | 152 | //0.1 is because the angle calculation is not accurate enough, so we need to go back a little bit. |
| 147 | var endCapPosition = Offset( | 153 | var endCapPosition = Offset( |
| @@ -150,29 +156,19 @@ class ProgressPainter extends CustomPainter { | @@ -150,29 +156,19 @@ class ProgressPainter extends CustomPainter { | ||
| 150 | ); | 156 | ); |
| 151 | 157 | ||
| 152 | canvas.translate(-centerX, -centerY); | 158 | canvas.translate(-centerX, -centerY); |
| 153 | - final endColor = getColorAtAngle(sweepAngle, progressColor[colorRangeIndex]); | 159 | + final endColor = |
| 160 | + getColorAtAngle(sweepAngle, progressColor[colorRangeIndex]); | ||
| 154 | if (sweepAngle > 355) { | 161 | if (sweepAngle > 355) { |
| 155 | //Draw arc shadow | 162 | //Draw arc shadow |
| 156 | var shadowPosition = Offset( | 163 | var shadowPosition = Offset( |
| 157 | centerX + radius * cos((startAngle).toRadians()), | 164 | centerX + radius * cos((startAngle).toRadians()), |
| 158 | - centerY + (reverse ? -5 : 5) + radius * sin((startAngle).toRadians()), | 165 | + centerY + (reverse ? -4 : 4) + radius * sin((startAngle).toRadians()), |
| 159 | ); | 166 | ); |
| 160 | final Paint shadowPaint = Paint() | 167 | final Paint shadowPaint = Paint() |
| 161 | - ..color = Colors.black.withOpacity(0.2) | ||
| 162 | - ..style = PaintingStyle.stroke | ||
| 163 | - ..strokeWidth = strokeWidth / 2 | 168 | + ..color = Colors.black.withOpacity(0.35) |
| 169 | + ..style = PaintingStyle.fill | ||
| 164 | ..maskFilter = const MaskFilter.blur(BlurStyle.normal, 3); | 170 | ..maskFilter = const MaskFilter.blur(BlurStyle.normal, 3); |
| 165 | - final Path path = Path() | ||
| 166 | - ..addArc( | ||
| 167 | - Rect.fromCenter( | ||
| 168 | - center: shadowPosition, | ||
| 169 | - width: strokeWidth / 2, | ||
| 170 | - height: strokeWidth / 2, | ||
| 171 | - ), | ||
| 172 | - 0, | ||
| 173 | - reverse ? -pi : pi, | ||
| 174 | - ); | ||
| 175 | - canvas.drawPath(path, shadowPaint); | 171 | + canvas.drawCircle(shadowPosition, strokeWidth / 2, shadowPaint); |
| 176 | } | 172 | } |
| 177 | 173 | ||
| 178 | //Draw the ending arc | 174 | //Draw the ending arc |
-
Please register or login to post a comment