浪漫雅圆(FlymeFont.ttf)脱色处理并添加代码适配
This commit is contained in:
Binary file not shown.
@@ -38,9 +38,11 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
RichText(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'Flyme',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.red,
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
const TextSpan(
|
const TextSpan(
|
||||||
@@ -50,29 +52,18 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(text: '${maxVolt.toStringAsFixed(3)}V'),
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
RichText(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'Flyme',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
const TextSpan(
|
const TextSpan(
|
||||||
@@ -82,20 +73,7 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(text: '${minVolt.toStringAsFixed(3)}V'),
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -111,16 +89,18 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
_buildInfoItem(
|
_buildInfoItem(
|
||||||
_buildIcon('temperature'),
|
_buildIcon('temperature'),
|
||||||
'温度',
|
'温度',
|
||||||
'${batteryTemp.toStringAsFixed(0)}°C',
|
'${batteryTemp.toStringAsFixed(0)}℃',
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
RichText(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'Flyme',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.red,
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
const TextSpan(
|
const TextSpan(
|
||||||
@@ -130,29 +110,18 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(text: '${maxTemp.toStringAsFixed(0)}℃'),
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
RichText(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'Flyme',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
const TextSpan(
|
const TextSpan(
|
||||||
@@ -162,20 +131,7 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(text: '${minTemp.toStringAsFixed(0)}℃'),
|
||||||
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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -226,9 +182,10 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
value,
|
value,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontFamily: 'Flyme', // 🟢 数字(含单位)用 Flyme
|
fontFamily: 'Flyme',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ class BatterySummary extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final bool isLowHealth = healthPercent < 70;
|
||||||
|
|
||||||
return Row(
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
@@ -31,18 +33,18 @@ class BatterySummary extends StatelessWidget {
|
|||||||
fontSize: 40,
|
fontSize: 40,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
color: healthPercent < 70 ? Colors.red : Colors.black,
|
color: isLowHealth ? Colors.red : Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 2),
|
const SizedBox(width: 2),
|
||||||
Text(
|
Text(
|
||||||
'%',
|
'%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'HarmonyOS_Sans_SC',
|
fontFamily: 'Flyme',
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
height: 1.0,
|
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: [
|
children: [
|
||||||
RichText(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'Flyme',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
height: 1.2,
|
height: 1.2,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
|
TextSpan(text: '$cycleCount'),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '$cycleCount',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontFamily: 'Flyme',
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const TextSpan(
|
|
||||||
text: ' cycles',
|
text: ' cycles',
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontFamily: 'HarmonyOS_Sans_SC',
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
@@ -81,40 +78,30 @@ class BatterySummary extends StatelessWidget {
|
|||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
RichText(
|
RichText(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'Flyme',
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
color: Colors.black,
|
color: const Color(0xFF5F5F5F),
|
||||||
),
|
),
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(text: currentCap.toStringAsFixed(0)),
|
||||||
text: currentCap.toStringAsFixed(0),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontFamily: 'Flyme',
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: ' / ',
|
text: ' / ',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'HarmonyOS_Sans_SC',
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
color: Colors.grey.shade500,
|
color: const Color(0xFF5F5F5F).withOpacity(0.5),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 🟢 设计容量数字用 Flyme,单位用 Harmony
|
TextSpan(text: designCap.toString()),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: designCap.toString(),
|
text: ' mAh',
|
||||||
style: const TextStyle(
|
|
||||||
fontFamily: 'Flyme',
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(
|
|
||||||
text: 'mAh',
|
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontFamily: 'HarmonyOS_Sans_SC',
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
color: Colors.black,
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Color(0xFF5F5F5F),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user