优化部分页面下UI显示问题

This commit is contained in:
2026-07-08 23:42:21 +08:00
parent 23d5c3b341
commit 9066b0f703
3 changed files with 59 additions and 44 deletions
+2 -1
View File
@@ -631,7 +631,8 @@ class _BatteryHealthPageState extends State<BatteryHealthPage>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>( return AnnotatedRegion<SystemUiOverlayStyle>(
value: const SystemUiOverlayStyle( value: const SystemUiOverlayStyle(
statusBarColor: Colors.white, // 🟢 1.5.0 统一状态栏颜色
statusBarColor: Color.fromRGBO(157, 212, 237, 0.1),
statusBarIconBrightness: Brightness.dark, statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.dark, statusBarBrightness: Brightness.dark,
), ),
+56 -42
View File
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../utils/charge_utils.dart'; import '../utils/charge_utils.dart';
/// 充电详情页 /// 充电详情页
@@ -11,14 +12,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';
@@ -27,7 +28,6 @@ class ChargeDetailPage extends StatelessWidget {
return chargeType; return chargeType;
} }
/// 🟢 1.5.0 标定档位显示
String _getRequestedDisplay() { String _getRequestedDisplay() {
return ChargeUtils.getDetailRequestedPowerWired( return ChargeUtils.getDetailRequestedPowerWired(
power, power,
@@ -36,58 +36,72 @@ class ChargeDetailPage extends StatelessWidget {
); );
} }
/// 🟢 1.5.0 实际功率显示
String _getActualDisplay() { String _getActualDisplay() {
return ChargeUtils.getDetailActualPowerWired(power, chargeType); return ChargeUtils.getDetailActualPowerWired(power, chargeType);
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return AnnotatedRegion<SystemUiOverlayStyle>(
appBar: AppBar( // 🟢 1.5.0 与主界面统一状态栏样式
title: const Text('充电详情'), value: const SystemUiOverlayStyle(
backgroundColor: Colors.transparent, statusBarColor: Color.fromRGBO(157, 212, 237, 0.5),
elevation: 0, statusBarIconBrightness: Brightness.dark,
foregroundColor: Colors.black, statusBarBrightness: Brightness.dark,
iconTheme: const IconThemeData(color: Colors.black),
), ),
body: Padding( child: Scaffold(
padding: const EdgeInsets.all(20.0), backgroundColor: Colors.white,
child: Column( appBar: AppBar(
crossAxisAlignment: CrossAxisAlignment.start, title: const Text('充电详情'),
children: [ backgroundColor: Colors.white, // 🟢 与主界面统一
_buildDetailRow('协议', _getProtocolDisplay()), elevation: 0,
const Divider(), scrolledUnderElevation: 0,
shadowColor: Colors.transparent,
// 🟢 1.5.0 有线充电:标定档位 + 实际功率 两行 surfaceTintColor: Colors.transparent,
if (!isWireless) ...[ foregroundColor: Colors.black,
_buildDetailRow('标定档位', _getRequestedDisplay()), iconTheme: const IconThemeData(color: Colors.black),
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildDetailRow('协议', _getProtocolDisplay()),
const Divider(), const Divider(),
_buildDetailRow('实际功率', _getActualDisplay()),
// 有线充电:标定档位 + 实际功率
if (!isWireless) ...[
_buildDetailRow('标定档位', _getRequestedDisplay()),
const Divider(),
_buildDetailRow('实际功率', _getActualDisplay()),
const Divider(),
] else ...[
_buildDetailRow(
'功率',
ChargeUtils.getDisplayPowerWireless(power),
),
const Divider(),
],
_buildDetailRow('电压', '${volt.toStringAsFixed(2)}V'),
const Divider(), const Divider(),
] else ...[ _buildDetailRow('电流', '${curr.toStringAsFixed(2)}A'),
// 无线充电:保持原样,只显示功率
_buildDetailRow('功率', ChargeUtils.getDisplayPowerWireless(power)),
const Divider(), const Divider(),
],
_buildDetailRow('电压', '${volt.toStringAsFixed(2)}V'), // 辅助信息
const Divider(), if (isWireless) _buildDetailRow('类型', '无线'),
_buildDetailRow('电流', '${curr.toStringAsFixed(2)}A'), if (!isWireless && wiredLevel == null)
const Divider(), _buildDetailRow('档位', '自动'),
// 辅助信息 const Spacer(),
if (isWireless) _buildDetailRow('类型', '无线'), Center(
if (!isWireless && wiredLevel == null) _buildDetailRow('档位', '自动'), child: Text(
'数据来自 BMS 实时日志',
const Spacer(), style: TextStyle(fontSize: 12, color: Colors.grey.shade500),
Center( ),
child: Text(
'数据来自 BMS 实时日志',
style: TextStyle(fontSize: 12, color: Colors.grey.shade500),
), ),
), ],
], ),
), ),
), ),
); );
+1 -1
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.5.0-dev.3 version: 1.5.0
environment: environment:
sdk: ^3.9.2 sdk: ^3.9.2