浪漫雅圆(FlymeFont.ttf)脱色处理并添加代码适配

This commit is contained in:
2026-07-14 22:58:37 +08:00
parent adc49fa1a5
commit bb9a3dc3f5
3 changed files with 38 additions and 94 deletions
+19 -32
View File
@@ -16,6 +16,8 @@ class BatterySummary extends StatelessWidget {
@override
Widget build(BuildContext context) {
final bool isLowHealth = healthPercent < 70;
return Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
@@ -31,18 +33,18 @@ class BatterySummary extends StatelessWidget {
fontSize: 40,
fontWeight: FontWeight.w500,
height: 1.0,
color: healthPercent < 70 ? Colors.red : Colors.black,
color: isLowHealth ? Colors.red : Colors.black,
),
),
const SizedBox(width: 2),
Text(
'%',
style: TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
fontFamily: 'Flyme',
fontSize: 20,
fontWeight: FontWeight.w300,
height: 1.0,
color: healthPercent < 70 ? Colors.red : Colors.grey.shade600,
color: isLowHealth ? Colors.red : Colors.grey.shade600,
),
),
],
@@ -54,23 +56,18 @@ class BatterySummary extends StatelessWidget {
children: [
RichText(
text: TextSpan(
style: const TextStyle(
style: TextStyle(
fontFamily: 'Flyme',
fontSize: 16,
fontWeight: FontWeight.w500,
height: 1.2,
color: Colors.black,
),
children: [
TextSpan(text: '$cycleCount'),
TextSpan(
text: '$cycleCount',
style: const TextStyle(
fontFamily: 'Flyme',
color: Colors.black,
),
),
const TextSpan(
text: ' cycles',
style: TextStyle(
style: const TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.black,
),
@@ -81,40 +78,30 @@ class BatterySummary extends StatelessWidget {
const SizedBox(height: 4),
RichText(
text: TextSpan(
style: const TextStyle(
style: TextStyle(
fontFamily: 'Flyme',
fontSize: 20,
fontWeight: FontWeight.w300,
height: 1.0,
color: Colors.black,
color: const Color(0xFF5F5F5F),
),
children: [
TextSpan(
text: currentCap.toStringAsFixed(0),
style: const TextStyle(
fontFamily: 'Flyme',
color: Colors.black,
),
),
TextSpan(text: currentCap.toStringAsFixed(0)),
TextSpan(
text: ' / ',
style: TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.grey.shade500,
color: const Color(0xFF5F5F5F).withOpacity(0.5),
),
),
// 🟢 设计容量数字用 Flyme,单位用 Harmony
TextSpan(text: designCap.toString()),
TextSpan(
text: designCap.toString(),
style: const TextStyle(
fontFamily: 'Flyme',
color: Colors.black,
),
),
TextSpan(
text: 'mAh',
text: ' mAh',
style: const TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.w500,
color: Color(0xFF5F5F5F),
),
),
],