更新一个字体

This commit is contained in:
2026-07-14 21:51:44 +08:00
parent 804b992ee4
commit adc49fa1a5
8 changed files with 298 additions and 76 deletions
+48 -21
View File
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
/// 电池健康度摘要组件(健康度 + cycles + mAh
class BatterySummary extends StatelessWidget {
final double healthPercent;
final int cycleCount;
@@ -28,6 +27,7 @@ class BatterySummary extends StatelessWidget {
Text(
healthPercent.toStringAsFixed(1),
style: TextStyle(
fontFamily: 'Flyme',
fontSize: 40,
fontWeight: FontWeight.w500,
height: 1.0,
@@ -38,6 +38,7 @@ class BatterySummary extends StatelessWidget {
Text(
'%',
style: TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
fontSize: 20,
fontWeight: FontWeight.w300,
height: 1.0,
@@ -51,47 +52,73 @@ class BatterySummary extends StatelessWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Text(
'$cycleCount cycles', // ✅ 修正:去掉下划线,使用 cycleCount
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
height: 1.2,
RichText(
text: TextSpan(
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
height: 1.2,
color: Colors.black,
),
children: [
TextSpan(
text: '$cycleCount',
style: const TextStyle(
fontFamily: 'Flyme',
color: Colors.black,
),
),
const TextSpan(
text: ' cycles',
style: TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.black,
),
),
],
),
),
const SizedBox(height: 4),
Text.rich(
TextSpan(
RichText(
text: TextSpan(
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
height: 1.0,
color: Colors.black,
),
children: [
TextSpan(
text: currentCap.toStringAsFixed(0),
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
fontFamily: 'Flyme',
color: Colors.black,
),
),
TextSpan(
text: ' / ',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.grey.shade500,
),
),
// 🟢 设计容量数字用 Flyme,单位用 Harmony
TextSpan(
text: '${designCap}mAh',
text: designCap.toString(),
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
fontFamily: 'Flyme',
color: Colors.black,
),
),
TextSpan(
text: 'mAh',
style: const TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.black,
),
),
],
),
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.w300,
height: 1.0,
),
),
],
),