更新一个字体
This commit is contained in:
Binary file not shown.
+40
-3
@@ -5,7 +5,6 @@ import 'services/saf_storage_service.dart';
|
|||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
// 🟢 初始化 SAF 服务
|
|
||||||
await SafStorageService().init();
|
await SafStorageService().init();
|
||||||
|
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
@@ -19,9 +18,47 @@ class MyApp extends StatelessWidget {
|
|||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: '电池健康度',
|
title: '电池健康度',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
// 🟢 中文用 HarmonyOS Sans SC
|
||||||
fontFamily: 'HarmonyOS_Sans_SC',
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
colorScheme: ColorScheme.fromSeed(
|
// 🟢 数字回退到 FlymeFont
|
||||||
seedColor: const Color.fromARGB(255, 255, 255, 255),
|
fontFamilyFallback: const ['Flyme'],
|
||||||
|
// 🟢 统一文字颜色为黑色
|
||||||
|
colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFFFFFFFF))
|
||||||
|
.copyWith(
|
||||||
|
onSurface: Colors.black, // 主要文字颜色
|
||||||
|
onBackground: Colors.black,
|
||||||
|
),
|
||||||
|
textTheme: const TextTheme(
|
||||||
|
// 大标题/数字(健康度、容量等)
|
||||||
|
displayMedium: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontFamilyFallback: ['Flyme'],
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
// 标题(如“容量百分比变动趋势”)
|
||||||
|
headlineMedium: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontFamilyFallback: ['Flyme'],
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
// 正文(电压、温度、循环次数等)
|
||||||
|
bodyMedium: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontFamilyFallback: ['Flyme'],
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
|
// 小字(日期、辅助信息)
|
||||||
|
bodySmall: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontFamilyFallback: ['Flyme'],
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
// 数字专用(大号数字,如健康度百分比)
|
||||||
|
displayLarge: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontFamilyFallback: ['Flyme'],
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
/// 电池信息面板(电压 + 温度 + 极值)
|
|
||||||
class BatteryInfoPanel extends StatelessWidget {
|
class BatteryInfoPanel extends StatelessWidget {
|
||||||
final double batteryVolt;
|
final double batteryVolt;
|
||||||
final double batteryTemp;
|
final double batteryTemp;
|
||||||
@@ -37,21 +36,67 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
RichText(
|
||||||
'↑ ${maxVolt.toStringAsFixed(3)}V',
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.red,
|
fontSize: 14,
|
||||||
fontSize: 14,
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w500,
|
),
|
||||||
|
children: [
|
||||||
|
const TextSpan(
|
||||||
|
text: '↑ ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Text(
|
RichText(
|
||||||
'↓ ${minVolt.toStringAsFixed(3)}V',
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.blue,
|
fontSize: 14,
|
||||||
fontSize: 14,
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w500,
|
),
|
||||||
|
children: [
|
||||||
|
const TextSpan(
|
||||||
|
text: '↓ ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -71,21 +116,67 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
RichText(
|
||||||
'↑ ${maxTemp.toStringAsFixed(0)}°C',
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.red,
|
fontSize: 14,
|
||||||
fontSize: 14,
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w500,
|
),
|
||||||
|
children: [
|
||||||
|
const TextSpan(
|
||||||
|
text: '↑ ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 12),
|
const SizedBox(width: 12),
|
||||||
Text(
|
RichText(
|
||||||
'↓ ${minTemp.toStringAsFixed(0)}°C',
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
color: Colors.blue,
|
fontSize: 14,
|
||||||
fontSize: 14,
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w500,
|
),
|
||||||
|
children: [
|
||||||
|
const TextSpan(
|
||||||
|
text: '↓ ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -123,11 +214,22 @@ class BatteryInfoPanel extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
icon,
|
icon,
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Text(label, style: const TextStyle(fontSize: 14, color: Colors.grey)),
|
Text(
|
||||||
|
label,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontSize: 14,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Text(
|
Text(
|
||||||
value,
|
value,
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
style: const TextStyle(
|
||||||
|
fontFamily: 'Flyme', // 🟢 数字(含单位)用 Flyme
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// 电池健康度摘要组件(健康度 + cycles + mAh)
|
|
||||||
class BatterySummary extends StatelessWidget {
|
class BatterySummary extends StatelessWidget {
|
||||||
final double healthPercent;
|
final double healthPercent;
|
||||||
final int cycleCount;
|
final int cycleCount;
|
||||||
@@ -28,6 +27,7 @@ class BatterySummary extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
healthPercent.toStringAsFixed(1),
|
healthPercent.toStringAsFixed(1),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'Flyme',
|
||||||
fontSize: 40,
|
fontSize: 40,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
@@ -38,6 +38,7 @@ class BatterySummary extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'%',
|
'%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
@@ -51,47 +52,73 @@ class BatterySummary extends StatelessWidget {
|
|||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
RichText(
|
||||||
'$cycleCount cycles', // ✅ 修正:去掉下划线,使用 cycleCount
|
text: TextSpan(
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
height: 1.2,
|
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),
|
const SizedBox(height: 4),
|
||||||
Text.rich(
|
RichText(
|
||||||
TextSpan(
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w300,
|
||||||
|
height: 1.0,
|
||||||
|
color: Colors.black,
|
||||||
|
),
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: currentCap.toStringAsFixed(0),
|
text: currentCap.toStringAsFixed(0),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 20,
|
fontFamily: 'Flyme',
|
||||||
fontWeight: FontWeight.w300,
|
color: Colors.black,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: ' / ',
|
text: ' / ',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
fontWeight: FontWeight.w300,
|
|
||||||
color: Colors.grey.shade500,
|
color: Colors.grey.shade500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// 🟢 设计容量数字用 Flyme,单位用 Harmony
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '${designCap}mAh',
|
text: designCap.toString(),
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 20,
|
fontFamily: 'Flyme',
|
||||||
fontWeight: FontWeight.w300,
|
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,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import '../utils/charge_utils.dart';
|
import '../utils/charge_utils.dart';
|
||||||
|
|
||||||
/// 充电详情页
|
|
||||||
class ChargeDetailPage extends StatelessWidget {
|
class ChargeDetailPage extends StatelessWidget {
|
||||||
final String chargeType;
|
final String chargeType;
|
||||||
final bool isWireless;
|
final bool isWireless;
|
||||||
@@ -12,14 +11,14 @@ class ChargeDetailPage extends StatelessWidget {
|
|||||||
final int? wiredLevel;
|
final int? wiredLevel;
|
||||||
|
|
||||||
const ChargeDetailPage({
|
const ChargeDetailPage({
|
||||||
super.key,
|
Key? key,
|
||||||
required this.chargeType,
|
required this.chargeType,
|
||||||
required this.isWireless,
|
required this.isWireless,
|
||||||
required this.power,
|
required this.power,
|
||||||
required this.volt,
|
required this.volt,
|
||||||
required this.curr,
|
required this.curr,
|
||||||
this.wiredLevel,
|
this.wiredLevel,
|
||||||
});
|
}) : super(key: key);
|
||||||
|
|
||||||
String _getProtocolDisplay() {
|
String _getProtocolDisplay() {
|
||||||
if (isWireless) return '无线充电($chargeType)';
|
if (isWireless) return '无线充电($chargeType)';
|
||||||
@@ -43,9 +42,8 @@ class ChargeDetailPage extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AnnotatedRegion<SystemUiOverlayStyle>(
|
return AnnotatedRegion<SystemUiOverlayStyle>(
|
||||||
// 🟢 1.5.0 与主界面统一状态栏样式
|
|
||||||
value: const SystemUiOverlayStyle(
|
value: const SystemUiOverlayStyle(
|
||||||
statusBarColor: Color.fromRGBO(157, 212, 237, 0.5),
|
statusBarColor: Color.fromRGBO(157, 212, 237, 0.1),
|
||||||
statusBarIconBrightness: Brightness.dark,
|
statusBarIconBrightness: Brightness.dark,
|
||||||
statusBarBrightness: Brightness.dark,
|
statusBarBrightness: Brightness.dark,
|
||||||
),
|
),
|
||||||
@@ -53,7 +51,7 @@ class ChargeDetailPage extends StatelessWidget {
|
|||||||
backgroundColor: Colors.white,
|
backgroundColor: Colors.white,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text('充电详情'),
|
title: const Text('充电详情'),
|
||||||
backgroundColor: Colors.white, // 🟢 与主界面统一
|
backgroundColor: Colors.white,
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
scrolledUnderElevation: 0,
|
scrolledUnderElevation: 0,
|
||||||
shadowColor: Colors.transparent,
|
shadowColor: Colors.transparent,
|
||||||
@@ -66,38 +64,36 @@ class ChargeDetailPage extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
_buildDetailRow('协议', _getProtocolDisplay()),
|
_buildTextRow('协议', _getProtocolDisplay()),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
|
||||||
// 有线充电:标定档位 + 实际功率
|
|
||||||
if (!isWireless) ...[
|
if (!isWireless) ...[
|
||||||
_buildDetailRow('标定档位', _getRequestedDisplay()),
|
_buildTextRow('标定档位', _getRequestedDisplay()),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
_buildDetailRow('实际功率', _getActualDisplay()),
|
_buildTextRow('实际功率', _getActualDisplay()),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
] else ...[
|
] else ...[
|
||||||
_buildDetailRow(
|
_buildTextRow('功率', ChargeUtils.getDisplayPowerWireless(power)),
|
||||||
'功率',
|
|
||||||
ChargeUtils.getDisplayPowerWireless(power),
|
|
||||||
),
|
|
||||||
const Divider(),
|
const Divider(),
|
||||||
],
|
],
|
||||||
|
|
||||||
_buildDetailRow('电压', '${volt.toStringAsFixed(2)}V'),
|
_buildDetailRow('电压', volt, 'V'),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
_buildDetailRow('电流', '${curr.toStringAsFixed(2)}A'),
|
_buildDetailRow('电流', curr, 'A'),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
|
|
||||||
// 辅助信息
|
if (isWireless) _buildTextRow('类型', '无线'),
|
||||||
if (isWireless) _buildDetailRow('类型', '无线'),
|
if (!isWireless && wiredLevel == null) _buildTextRow('档位', '自动'),
|
||||||
if (!isWireless && wiredLevel == null)
|
|
||||||
_buildDetailRow('档位', '自动'),
|
|
||||||
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Center(
|
Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'数据来自 BMS 实时日志',
|
'数据来自 BMS 实时日志',
|
||||||
style: TextStyle(fontSize: 12, color: Colors.grey.shade500),
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey.shade500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -107,7 +103,8 @@ class ChargeDetailPage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDetailRow(String label, String value) {
|
/// 纯文本行(协议、功率、档位等)
|
||||||
|
Widget _buildTextRow(String label, String value) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6.0),
|
padding: const EdgeInsets.symmetric(vertical: 6.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
@@ -116,6 +113,7 @@ class ChargeDetailPage extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
label,
|
label,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
@@ -124,6 +122,7 @@ class ChargeDetailPage extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
value,
|
value,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC', // 复杂字符串保持 Harmony
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
@@ -133,4 +132,44 @@ class ChargeDetailPage extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 数值行(电压/电流,数字用 Flyme,单位用 Harmony)
|
||||||
|
Widget _buildDetailRow(String label, double value, String unit) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 6.0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: Colors.black87,
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: value.toStringAsFixed(2),
|
||||||
|
style: const TextStyle(fontFamily: 'Flyme'), // 🟢 数字用 Flyme
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: unit,
|
||||||
|
style: const TextStyle(fontFamily: 'HarmonyOS_Sans_SC'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// 充电入口行(显示充电状态 + 点击进入详情)
|
|
||||||
class ChargeEntry extends StatelessWidget {
|
class ChargeEntry extends StatelessWidget {
|
||||||
final String summary;
|
final String summary;
|
||||||
final bool isCharging;
|
final bool isCharging;
|
||||||
@@ -23,6 +22,7 @@ class ChargeEntry extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
summary,
|
summary,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC', // 🟢 混合文本用 Harmony
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Colors.black87,
|
color: Colors.black87,
|
||||||
@@ -33,6 +33,7 @@ class ChargeEntry extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'充电信息',
|
'充电信息',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Colors.grey.shade700,
|
color: Colors.grey.shade700,
|
||||||
@@ -42,6 +43,7 @@ class ChargeEntry extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'>',
|
'>',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
color: Colors.grey.shade700,
|
color: Colors.grey.shade700,
|
||||||
|
|||||||
@@ -50,7 +50,11 @@ class TrendChart extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
const Text(
|
const Text(
|
||||||
'容量百分比变动趋势(近15天)',
|
'容量百分比变动趋势(近15天)',
|
||||||
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
@@ -64,6 +68,7 @@ class TrendChart extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'100',
|
'100',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'Flyme',
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
@@ -72,6 +77,7 @@ class TrendChart extends StatelessWidget {
|
|||||||
Text(
|
Text(
|
||||||
'70',
|
'70',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
fontFamily: 'Flyme',
|
||||||
fontSize: 10,
|
fontSize: 10,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
@@ -139,6 +145,7 @@ class TrendChart extends StatelessWidget {
|
|||||||
child: Text(
|
child: Text(
|
||||||
sevenDaysAgoDate,
|
sevenDaysAgoDate,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
@@ -152,6 +159,7 @@ class TrendChart extends StatelessWidget {
|
|||||||
child: Text(
|
child: Text(
|
||||||
todayDate,
|
todayDate,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
@@ -172,7 +180,11 @@ class TrendChart extends StatelessWidget {
|
|||||||
padding: EdgeInsets.only(top: 8.0),
|
padding: EdgeInsets.only(top: 8.0),
|
||||||
child: Text(
|
child: Text(
|
||||||
'暂无历史数据,请点击刷新按钮更新',
|
'暂无历史数据,请点击刷新按钮更新',
|
||||||
style: TextStyle(fontSize: 12, color: Colors.grey),
|
style: TextStyle(
|
||||||
|
fontFamily: 'HarmonyOS_Sans_SC',
|
||||||
|
fontSize: 12,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -75,6 +75,9 @@ flutter:
|
|||||||
weight: 400
|
weight: 400
|
||||||
- asset: assets/fonts/HarmonyOS_Sans_SC_Medium.ttf
|
- asset: assets/fonts/HarmonyOS_Sans_SC_Medium.ttf
|
||||||
weight: 500
|
weight: 500
|
||||||
|
- family: Flyme
|
||||||
|
fonts:
|
||||||
|
- asset: assets/fonts/flymeFont.ttf
|
||||||
assets:
|
assets:
|
||||||
- assets/icons/
|
- assets/icons/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user