浪漫雅圆(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
Binary file not shown.
+19 -62
View File
@@ -38,9 +38,11 @@ class BatteryInfoPanel extends StatelessWidget {
children: [
RichText(
text: TextSpan(
style: const TextStyle(
style: TextStyle(
fontFamily: 'Flyme',
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.red,
),
children: [
const TextSpan(
@@ -50,29 +52,18 @@ class BatteryInfoPanel extends StatelessWidget {
color: Colors.red,
),
),
TextSpan(
text: maxVolt.toStringAsFixed(3),
style: const TextStyle(
fontFamily: 'Flyme', // 🟢 数字用 Flyme
color: Colors.red,
),
),
const TextSpan(
text: 'V',
style: TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.red,
),
),
TextSpan(text: '${maxVolt.toStringAsFixed(3)}V'),
],
),
),
const SizedBox(width: 12),
RichText(
text: TextSpan(
style: const TextStyle(
style: TextStyle(
fontFamily: 'Flyme',
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.blue,
),
children: [
const TextSpan(
@@ -82,20 +73,7 @@ class BatteryInfoPanel extends StatelessWidget {
color: Colors.blue,
),
),
TextSpan(
text: minVolt.toStringAsFixed(3),
style: const TextStyle(
fontFamily: 'Flyme', // 🟢 数字用 Flyme
color: Colors.blue,
),
),
const TextSpan(
text: 'V',
style: TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.blue,
),
),
TextSpan(text: '${minVolt.toStringAsFixed(3)}V'),
],
),
),
@@ -111,16 +89,18 @@ class BatteryInfoPanel extends StatelessWidget {
_buildInfoItem(
_buildIcon('temperature'),
'温度',
'${batteryTemp.toStringAsFixed(0)}°C',
'${batteryTemp.toStringAsFixed(0)}',
),
const SizedBox(height: 8),
Row(
children: [
RichText(
text: TextSpan(
style: const TextStyle(
style: TextStyle(
fontFamily: 'Flyme',
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.red,
),
children: [
const TextSpan(
@@ -130,29 +110,18 @@ class BatteryInfoPanel extends StatelessWidget {
color: Colors.red,
),
),
TextSpan(
text: maxTemp.toStringAsFixed(0),
style: const TextStyle(
fontFamily: 'Flyme', // 🟢 数字用 Flyme
color: Colors.red,
),
),
const TextSpan(
text: '°C',
style: TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.red,
),
),
TextSpan(text: '${maxTemp.toStringAsFixed(0)}'),
],
),
),
const SizedBox(width: 12),
RichText(
text: TextSpan(
style: const TextStyle(
style: TextStyle(
fontFamily: 'Flyme',
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.blue,
),
children: [
const TextSpan(
@@ -162,20 +131,7 @@ class BatteryInfoPanel extends StatelessWidget {
color: Colors.blue,
),
),
TextSpan(
text: minTemp.toStringAsFixed(0),
style: const TextStyle(
fontFamily: 'Flyme', // 🟢 数字用 Flyme
color: Colors.blue,
),
),
const TextSpan(
text: '°C',
style: TextStyle(
fontFamily: 'HarmonyOS_Sans_SC',
color: Colors.blue,
),
),
TextSpan(text: '${minTemp.toStringAsFixed(0)}'),
],
),
),
@@ -226,9 +182,10 @@ class BatteryInfoPanel extends StatelessWidget {
Text(
value,
style: const TextStyle(
fontFamily: 'Flyme', // 🟢 数字(含单位)用 Flyme
fontFamily: 'Flyme',
fontSize: 16,
fontWeight: FontWeight.w500,
color: Colors.black,
),
),
],
+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),
),
),
],