所有一级页面和不分二级页面

This commit is contained in:
2026-05-25 12:58:29 +08:00
parent b9f747de05
commit afef5c4ef1
158 changed files with 13082 additions and 1602 deletions

View File

@@ -10,23 +10,26 @@ class StatsGrid extends StatelessWidget {
Widget build(BuildContext context) {
return GridView.count(
crossAxisCount: 2,
childAspectRatio: 1.5,
childAspectRatio: 1.8,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
mainAxisSpacing: 12,
crossAxisSpacing: 12,
mainAxisSpacing: 8,
crossAxisSpacing: 8,
padding: EdgeInsets.zero,
children: [
_buildStatCard(
title: '今日发电量',
value: data.todayGeneration.toStringAsFixed(0),
value: _formatNumber(data.todayGeneration),
unit: 'kWh',
valueColor: const Color(0xFF00B42A),
showArrow: false,
),
_buildStatCard(
title: '等效小时数',
value: data.equivalentHours.toStringAsFixed(1),
unit: 'h',
valueColor: const Color(0xFF165DFF),
showArrow: false,
),
_buildAlarmCard(data.alarmCount),
_buildWorkOrderCard(data.pendingWorkOrders),
@@ -39,9 +42,10 @@ class StatsGrid extends StatelessWidget {
required String value,
required String unit,
required Color valueColor,
bool showArrow = false,
}) {
return Container(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
@@ -56,23 +60,32 @@ class StatsGrid extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: const TextStyle(
color: Color(0xFF4E5969),
fontSize: 14,
if (showArrow)
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
style: const TextStyle(
color: Color(0xFF4E5969),
fontSize: 14,
),
),
const Icon(
Icons.arrow_forward_ios,
size: 14,
color: Color(0xFF86909C),
),
],
)
else
Text(
title,
style: const TextStyle(
color: Color(0xFF4E5969),
fontSize: 14,
),
const Icon(
Icons.arrow_forward_ios,
size: 14,
color: Color(0xFF86909C),
),
],
),
),
const Spacer(),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
@@ -102,7 +115,7 @@ class StatsGrid extends StatelessWidget {
Widget _buildAlarmCard(int count) {
return Container(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.fromLTRB(12, 0, 12, 12),
decoration: BoxDecoration(
color: const Color(0xFFFFF0F0),
borderRadius: BorderRadius.circular(16),
@@ -125,15 +138,15 @@ class StatsGrid extends StatelessWidget {
'告警数',
style: TextStyle(
color: Color(0xFFF53F3F),
fontSize: 14,
fontSize: 13,
),
),
const SizedBox(height: 8),
const SizedBox(height: 4),
Text(
count.toString(),
style: const TextStyle(
color: Color(0xFFF53F3F),
fontSize: 32,
fontSize: 28,
fontWeight: FontWeight.bold,
),
),
@@ -141,15 +154,15 @@ class StatsGrid extends StatelessWidget {
),
),
Container(
width: 48,
height: 48,
width: 44,
height: 44,
decoration: const BoxDecoration(
color: Color(0xFFFFE8E8),
shape: BoxShape.circle,
),
child: const Icon(
Icons.notifications_active,
size: 28,
Icons.notifications_none,
size: 24,
color: Color(0xFFF53F3F),
),
),
@@ -160,7 +173,7 @@ class StatsGrid extends StatelessWidget {
Widget _buildWorkOrderCard(int count) {
return Container(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.fromLTRB(12, 0, 12, 12),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
@@ -183,15 +196,15 @@ class StatsGrid extends StatelessWidget {
'待办工单',
style: TextStyle(
color: Color(0xFF4E5969),
fontSize: 14,
fontSize: 13,
),
),
const SizedBox(height: 8),
const SizedBox(height: 4),
Text(
count.toString(),
style: const TextStyle(
color: Color(0xFF1D2129),
fontSize: 32,
fontSize: 28,
fontWeight: FontWeight.bold,
),
),
@@ -199,15 +212,15 @@ class StatsGrid extends StatelessWidget {
),
),
Container(
width: 48,
height: 48,
width: 44,
height: 44,
decoration: const BoxDecoration(
color: Color(0xFFE8F3FF),
shape: BoxShape.circle,
),
child: const Icon(
Icons.assignment,
size: 28,
Icons.content_paste,
size: 24,
color: Color(0xFF165DFF),
),
),
@@ -215,4 +228,18 @@ class StatsGrid extends StatelessWidget {
),
);
}
String _formatNumber(double number) {
final formatted = number.toStringAsFixed(0);
final parts = formatted.split('.');
final intPart = parts[0];
final buffer = StringBuffer();
for (int i = 0; i < intPart.length; i++) {
if (i > 0 && (intPart.length - i) % 3 == 0) {
buffer.write(',');
}
buffer.write(intPart[i]);
}
return buffer.toString();
}
}