深色模式代码第二轮补充
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../theme/app_colors.dart';
|
||||
|
||||
// --- 潘通色定义 ---
|
||||
const Color kHealthGreen = Color(0xFF00B140);
|
||||
const Color kHealthYellow = Color(0xFFEFDF00);
|
||||
const Color kHealthOrange = Color(0xFFD75A16);
|
||||
|
||||
/// 趋势图柱状图组件
|
||||
class TrendChart extends StatelessWidget {
|
||||
final List<Map<String, dynamic>> data;
|
||||
final int designCap;
|
||||
@@ -14,6 +9,8 @@ class TrendChart extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final c = context.colors;
|
||||
|
||||
List<Map<String, dynamic>> displayData = data.isNotEmpty
|
||||
? data
|
||||
: _getMockData();
|
||||
@@ -48,12 +45,13 @@ class TrendChart extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
'容量百分比变动趋势(近15天)',
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: c.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
@@ -64,13 +62,13 @@ class TrendChart extends StatelessWidget {
|
||||
height: 180,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: const [
|
||||
children: [
|
||||
Text(
|
||||
'100',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Flyme',
|
||||
fontSize: 10,
|
||||
color: Colors.grey,
|
||||
color: c.textTertiary,
|
||||
height: 1.0,
|
||||
),
|
||||
),
|
||||
@@ -79,7 +77,7 @@ class TrendChart extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontFamily: 'Flyme',
|
||||
fontSize: 10,
|
||||
color: Colors.grey,
|
||||
color: c.textTertiary,
|
||||
height: 1.0,
|
||||
),
|
||||
),
|
||||
@@ -106,14 +104,14 @@ class TrendChart extends StatelessWidget {
|
||||
Color barColor;
|
||||
if (value > 0) {
|
||||
if (value >= 80) {
|
||||
barColor = kHealthGreen;
|
||||
barColor = c.healthGreen;
|
||||
} else if (value >= 70) {
|
||||
barColor = kHealthYellow;
|
||||
barColor = c.healthYellow;
|
||||
} else {
|
||||
barColor = Colors.red;
|
||||
barColor = c.healthRed;
|
||||
}
|
||||
} else {
|
||||
barColor = Colors.grey.shade300;
|
||||
barColor = c.barEmpty;
|
||||
}
|
||||
double clampedValue = value.clamp(70.0, 100.0);
|
||||
double heightFactor =
|
||||
@@ -144,10 +142,10 @@ class TrendChart extends StatelessWidget {
|
||||
bottom: 2,
|
||||
child: Text(
|
||||
sevenDaysAgoDate,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 9,
|
||||
color: Colors.grey,
|
||||
color: c.textTertiary,
|
||||
height: 1.0,
|
||||
),
|
||||
),
|
||||
@@ -158,10 +156,10 @@ class TrendChart extends StatelessWidget {
|
||||
bottom: 2,
|
||||
child: Text(
|
||||
todayDate,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 9,
|
||||
color: Colors.black,
|
||||
color: c.textPrimary,
|
||||
height: 1.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -176,14 +174,14 @@ class TrendChart extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
if (percents.every((v) => v == 0))
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 8.0),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8.0),
|
||||
child: Text(
|
||||
'暂无历史数据,请点击刷新按钮更新',
|
||||
style: TextStyle(
|
||||
fontFamily: 'HarmonyOS_Sans_SC',
|
||||
fontSize: 12,
|
||||
color: Colors.grey,
|
||||
color: c.textTertiary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user