Commit c14c1cfcf0482d375c1d152c09ccd19c62f3036c

Authored by 常守达
1 parent 068524a7

fix(ui):验收修复2

... ... @@ -330,11 +330,27 @@ class _QuestionBottomSheet extends StatelessWidget {
SizedBox(height: 8),
SizedBox(
height: 56,
child: Stack(
alignment: Alignment.center,
child: Row(
// alignment: Alignment.center,
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 72),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: Get.back,
child: SizedBox(
width: 44,
height: 44,
child: Center(
child: Image.asset(
'assets/images/common/ic_close.png',
width: 20,
height: 20,
color: context.colors.chartPurple,
),
),
),
),
Expanded(
child: Text(
item.title,
maxLines: 1,
... ... @@ -348,25 +364,9 @@ class _QuestionBottomSheet extends StatelessWidget {
),
),
),
Positioned(
left: 16,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: Get.back,
child: SizedBox(
width: 44,
height: 44,
child: Center(
child: Image.asset(
'assets/images/common/ic_close.png',
width: 20,
height: 20,
color: context.colors.chartPurple,
),
),
),
),
),
SizedBox(
width: 44,
)
],
),
),
... ...
... ... @@ -113,18 +113,6 @@ class TodayController extends GetMaterialController {
showPartnerAdBanner.value = false;
}
// ── HRV 数字 + 心率 ───────────────────────
final avgHrv = '--'.obs;
final restingHeartRate = '--'.obs;
// ── 健身卡片 ──────────────────────────────
final activityCalories = '--'.obs;
final activityExerciseMinutes = '--'.obs;
final activityStandHours = '--'.obs;
final activityMoveProgress = 0.0.obs;
final activityExerciseProgress = 0.0.obs;
final activityStandProgress = 0.0.obs;
// ── HRV 趋势图 ────────────────────────────
final hrvChartData = <V2HrvTrendItem>[].obs;
final stressChartData = <V2RealtimeStressItem>[].obs;
... ... @@ -456,18 +444,11 @@ class TodayController extends GetMaterialController {
}
void _clearRealTimeData() {
restingHeartRate.value = '--';
activityCalories.value = '--';
activityExerciseMinutes.value = '--';
activityStandHours.value = '--';
activityMoveProgress.value = 0.0;
activityExerciseProgress.value = 0.0;
activityStandProgress.value = 0.0;
hrvChartData.clear();
stressChartData.clear();
hrvAnnotations.clear();
avgHrv.value = '--';
v2HealthData.value = null;
}
toTrendHrvPage() {
... ...
... ... @@ -178,18 +178,13 @@ class TodayTabBody extends StatelessWidget {
),
),
),
Obx(
() => controller.isLoadingToday.value
? Lottie.asset(
'assets/lottie/loading.json',
width: 65,
height: 45,
repeat: true,
animate: true,
)
: Padding(
padding: const EdgeInsets.only(bottom: 12),
child: Text(
Container(
height: 51,
alignment: Alignment.topCenter,
child: Obx(
() => controller.isLoadingToday.value
? CircularProgressIndicator(strokeWidth: 2.5)
: Text(
controller.v2StressScore.value?.stateString() ??
'',
textAlign: TextAlign.center,
... ... @@ -199,7 +194,7 @@ class TodayTabBody extends StatelessWidget {
fontWeight: FontWeight.w500,
),
),
),
),
),
Obx(
() => StressProgressBar(
... ...
... ... @@ -72,13 +72,7 @@ class TodayHrvChartCard extends StatelessWidget {
),
if (controller.isLoadingToday.value)
Center(
child: Lottie.asset(
'assets/lottie/loading.json',
width: 130,
height: 90,
repeat: true,
animate: true,
),
child: CircularProgressIndicator(strokeWidth: 2.5),
)
else if (hrvSpots.isEmpty)
_EmptyChart(text: context.l10n.noDataAvailableForToday)
... ... @@ -264,13 +258,7 @@ class TodayHrvChartCard extends StatelessWidget {
),
if (controller.isLoadingToday.value)
Center(
child: Lottie.asset(
'assets/lottie/loading.json',
width: 130,
height: 90,
repeat: true,
animate: true,
),
child: CircularProgressIndicator(strokeWidth: 2.5),
)
else if (stressPoints.isEmpty)
_EmptyChart(text: context.l10n.noPressureDataAvailableAtThisTime)
... ...
... ... @@ -65,7 +65,9 @@ class ProgressPainter extends CustomPainter {
var shader = SweepGradient(
startAngle: startAngle.toRadians(),
endAngle: 360.toRadians(),
colors: reverse ? progressColor[colorRangeIndex].reversed.toList() : progressColor[colorRangeIndex],
colors: reverse
? progressColor[colorRangeIndex].reversed.toList()
: progressColor[colorRangeIndex],
).createShader(rect);
var paint = Paint()
... ... @@ -101,7 +103,8 @@ class ProgressPainter extends CustomPainter {
if (sweepAngle > 360) {
rotationAngle = 360 - sweepAngle;
}
double rotationRadians = reverse ? -rotationAngle.toRadians() : rotationAngle.toRadians();
double rotationRadians =
reverse ? -rotationAngle.toRadians() : rotationAngle.toRadians();
// Rotate the canvas
canvas.rotate((-90).toRadians() - rotationRadians);
// Move the canvas origin back
... ... @@ -123,7 +126,9 @@ class ProgressPainter extends CustomPainter {
canvas.drawArc(
rect,
0.toRadians(),
reverse ? -(startAngle + sweepAngle).toRadians() : (startAngle + sweepAngle).toRadians(),
reverse
? -(startAngle + sweepAngle).toRadians()
: (startAngle + sweepAngle).toRadians(),
false,
paint,
);
... ... @@ -141,7 +146,8 @@ class ProgressPainter extends CustomPainter {
canvas.translate(centerX, centerY);
if (sweepAngle < 360) {
final endCapRotate = 360 - sweepAngle;
canvas.rotate(reverse ? endCapRotate.toRadians() : -endCapRotate.toRadians());
canvas.rotate(
reverse ? endCapRotate.toRadians() : -endCapRotate.toRadians());
}
//0.1 is because the angle calculation is not accurate enough, so we need to go back a little bit.
var endCapPosition = Offset(
... ... @@ -150,29 +156,19 @@ class ProgressPainter extends CustomPainter {
);
canvas.translate(-centerX, -centerY);
final endColor = getColorAtAngle(sweepAngle, progressColor[colorRangeIndex]);
final endColor =
getColorAtAngle(sweepAngle, progressColor[colorRangeIndex]);
if (sweepAngle > 355) {
//Draw arc shadow
var shadowPosition = Offset(
centerX + radius * cos((startAngle).toRadians()),
centerY + (reverse ? -5 : 5) + radius * sin((startAngle).toRadians()),
centerY + (reverse ? -4 : 4) + radius * sin((startAngle).toRadians()),
);
final Paint shadowPaint = Paint()
..color = Colors.black.withOpacity(0.2)
..style = PaintingStyle.stroke
..strokeWidth = strokeWidth / 2
..color = Colors.black.withOpacity(0.35)
..style = PaintingStyle.fill
..maskFilter = const MaskFilter.blur(BlurStyle.normal, 3);
final Path path = Path()
..addArc(
Rect.fromCenter(
center: shadowPosition,
width: strokeWidth / 2,
height: strokeWidth / 2,
),
0,
reverse ? -pi : pi,
);
canvas.drawPath(path, shadowPaint);
canvas.drawCircle(shadowPosition, strokeWidth / 2, shadowPaint);
}
//Draw the ending arc
... ...