所有一级页面和不分二级页面
This commit is contained in:
@@ -19,12 +19,18 @@ class HomeV2Page extends StatefulWidget {
|
||||
|
||||
class _HomeV2PageState extends State<HomeV2Page> {
|
||||
late HomeV2Bloc _bloc;
|
||||
String _selectedPlant = '示例光伏电站';
|
||||
final List<String> _plantList = [
|
||||
'示例光伏电站',
|
||||
'一号光伏电站',
|
||||
'二号光伏电站',
|
||||
'三号光伏电站',
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_bloc = context.read<HomeV2Bloc>();
|
||||
_bloc.add(const HomeV2LoadData());
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -33,12 +39,6 @@ class _HomeV2PageState extends State<HomeV2Page> {
|
||||
backgroundColor: const Color(0xFFF5F7FA),
|
||||
body: BlocBuilder<HomeV2Bloc, HomeV2State>(
|
||||
builder: (context, state) {
|
||||
if (state is HomeV2Loading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
if (state is HomeV2Error) {
|
||||
return Center(
|
||||
child: Column(
|
||||
@@ -68,86 +68,40 @@ class _HomeV2PageState extends State<HomeV2Page> {
|
||||
pinned: true,
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
padding: const EdgeInsets.fromLTRB(16, 40, 16, 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
padding: const EdgeInsets.fromLTRB(16, 40, 16, 16),
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
const Text(
|
||||
'示例光伏电站',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: _showPlantSelector,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
_selectedPlant,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.arrow_drop_down, size: 20, color: Color(0xFF1D2129)),
|
||||
],
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.arrow_drop_down, size: 20, color: Color(0xFF1D2129)),
|
||||
const Spacer(),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.sentiment_satisfied_alt_outlined, size: 24),
|
||||
onPressed: () => print('点击表情'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF2F3F5),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.cloud_queue, size: 16, color: Color(0xFF165DFF)),
|
||||
const SizedBox(width: 6),
|
||||
const Text(
|
||||
'多云 28°C',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFFF0F0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.warning_amber_rounded, size: 16, color: Color(0xFFF53F3F)),
|
||||
const SizedBox(width: 6),
|
||||
const Expanded(
|
||||
child: Text(
|
||||
'紧急告警',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFFF53F3F),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.arrow_forward_ios, size: 12, color: Color(0xFFF53F3F)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
IconButton(
|
||||
icon: const Icon(Icons.qr_code_scanner, size: 24, color: Color(0xFF1D2129)),
|
||||
onPressed: () => print('点击扫码'),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -155,25 +109,83 @@ class _HomeV2PageState extends State<HomeV2Page> {
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 40),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildListDelegate([
|
||||
const SizedBox(height: 16),
|
||||
// 天气和告警
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF2F3F5),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.cloud_queue, size: 16, color: Color(0xFF165DFF)),
|
||||
const SizedBox(width: 6),
|
||||
const Text(
|
||||
'多云 28°C',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFFFF0F0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(Icons.warning_amber_rounded, size: 16, color: Color(0xFFF53F3F)),
|
||||
const SizedBox(width: 6),
|
||||
const Expanded(
|
||||
child: Text(
|
||||
'紧急告警',
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: Color(0xFFF53F3F),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Icon(Icons.arrow_forward_ios, size: 12, color: Color(0xFFF53F3F)),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
PowerCard(data: state.homeData),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 10),
|
||||
StatsGrid(data: state.homeData),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 10),
|
||||
PlantOverviewCard(overview: state.homeData.plantOverview),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 10),
|
||||
WorkOrderCard(stats: state.homeData.workOrderStats),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 10),
|
||||
QuickEntryCard(),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 10),
|
||||
PowerTrendChart(
|
||||
data: state.homeData.powerTrendData,
|
||||
trendType: state.trendType,
|
||||
onToggleType: (type) => _bloc.add(HomeV2ToggleTrendType(type)),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 40),
|
||||
]),
|
||||
),
|
||||
),
|
||||
@@ -187,4 +199,54 @@ class _HomeV2PageState extends State<HomeV2Page> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
// 首次进入时自动加载数据,但不显示转圈
|
||||
if (_bloc.state is HomeV2Initial) {
|
||||
_bloc.add(const HomeV2LoadData());
|
||||
}
|
||||
}
|
||||
|
||||
void _showPlantSelector() {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
backgroundColor: Colors.white,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(16)),
|
||||
),
|
||||
builder: (context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text(
|
||||
'选择电站',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 14),
|
||||
..._plantList.map((plant) => ListTile(
|
||||
title: Text(plant),
|
||||
trailing: _selectedPlant == plant
|
||||
? const Icon(Icons.check, color: Color(0xFF165DFF))
|
||||
: null,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selectedPlant = plant;
|
||||
});
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,12 @@ class PowerCard extends StatelessWidget {
|
||||
height: 140,
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [Color(0xFF165DFF), Color(0xFF4080FF)],
|
||||
colors: [
|
||||
Color(0xFF165DFF),
|
||||
Color(0xFF4080FF),
|
||||
Color(0xFF7CB3FF),
|
||||
Color(0xFFB8D4FF),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
|
||||
@@ -87,10 +87,16 @@ class PowerTrendChart extends StatelessWidget {
|
||||
reservedSize: 30,
|
||||
interval: 6,
|
||||
getTitlesWidget: (value, meta) {
|
||||
const titles = ['00:00', '06:00', '12:00', '18:00', '24:00'];
|
||||
if (value.toInt() % 6 == 0 && value.toInt() < titles.length) {
|
||||
final index = value.toInt();
|
||||
if (index == 0 || index == 6 || index == 12 || index == 18 || index == 23) {
|
||||
String time;
|
||||
if (index == 23) {
|
||||
time = '23:00';
|
||||
} else {
|
||||
time = '${index.toString().padLeft(2, '0')}:00';
|
||||
}
|
||||
return Text(
|
||||
titles[value.toInt() ~/ 6],
|
||||
time,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF86909C),
|
||||
fontSize: 12,
|
||||
|
||||
@@ -27,11 +27,65 @@ class QuickEntryCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
SizedBox(
|
||||
height: 85,
|
||||
child: ListView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: const EdgeInsets.only(right: 16),
|
||||
children: [
|
||||
_buildQuickEntryCard(
|
||||
icon: Icons.upload_file,
|
||||
label: '设备上报',
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildQuickEntryCard(
|
||||
icon: Icons.qr_code_scanner,
|
||||
label: '扫一扫',
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildQuickEntryCard(
|
||||
icon: Icons.assignment,
|
||||
label: '工单任务',
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildQuickEntryCard(
|
||||
icon: Icons.notifications_active,
|
||||
label: '告警中心',
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildQuickEntryCard(
|
||||
icon: Icons.map,
|
||||
label: '电厂地图',
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
_buildQuickEntryCard(
|
||||
icon: Icons.devices,
|
||||
label: '设备列表',
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildQuickEntryCard({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: () => print('点击:$label'),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: SizedBox(
|
||||
width: 85,
|
||||
height: 85,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
@@ -40,54 +94,29 @@ class QuickEntryCard extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
_buildQuickEntryItem(
|
||||
icon: Icons.upload_file,
|
||||
label: '设备上报',
|
||||
Icon(
|
||||
icon,
|
||||
color: const Color(0xFF165DFF),
|
||||
size: 26,
|
||||
),
|
||||
_buildQuickEntryItem(
|
||||
icon: Icons.qr_code_scanner,
|
||||
label: '扫一扫',
|
||||
),
|
||||
_buildQuickEntryItem(
|
||||
icon: Icons.assignment,
|
||||
label: '工单任务',
|
||||
),
|
||||
_buildQuickEntryItem(
|
||||
icon: Icons.notifications_active,
|
||||
label: '告警中心',
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
label,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF4E5969),
|
||||
fontSize: 12,
|
||||
height: 1.2,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildQuickEntryItem({
|
||||
required IconData icon,
|
||||
required String label,
|
||||
}) {
|
||||
return InkWell(
|
||||
onTap: () => print('点击:$label'),
|
||||
child: Column(
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
color: const Color(0xFF165DFF),
|
||||
size: 32,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFF4E5969),
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,96 +30,95 @@ class WorkOrderCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildWorkOrderCard(
|
||||
title: '待处理',
|
||||
count: stats.pending,
|
||||
color: const Color(0xFFF53F3F),
|
||||
bgColor: Colors.white,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildWorkOrderItem(
|
||||
title: '待处理',
|
||||
count: stats.pending,
|
||||
color: const Color(0xFFF53F3F),
|
||||
bgColor: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: _buildWorkOrderCard(
|
||||
title: '处理中',
|
||||
count: stats.processing,
|
||||
color: const Color(0xFFFF7D00),
|
||||
bgColor: const Color(0xFFFFF7E6),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: _buildWorkOrderItem(
|
||||
title: '处理中',
|
||||
count: stats.processing,
|
||||
color: const Color(0xFFFF7D00),
|
||||
bgColor: const Color(0xFFFFF7E6),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: _buildWorkOrderCard(
|
||||
title: '待验收',
|
||||
count: stats.pendingAcceptance,
|
||||
color: const Color(0xFF1D2129),
|
||||
bgColor: Colors.white,
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: _buildWorkOrderItem(
|
||||
title: '待验收',
|
||||
count: stats.pendingAcceptance,
|
||||
color: const Color(0xFF1D2129),
|
||||
bgColor: Colors.white,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildWorkOrderItem({
|
||||
Widget _buildWorkOrderCard({
|
||||
required String title,
|
||||
required int count,
|
||||
required Color color,
|
||||
required Color bgColor,
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: color,
|
||||
fontSize: 14,
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
// TODO: 点击跳转逻辑
|
||||
},
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: color,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
count.toString(),
|
||||
style: TextStyle(
|
||||
color: color,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
count.toString(),
|
||||
style: TextStyle(
|
||||
color: color,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 16,
|
||||
color: color.withOpacity(0.5),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 14,
|
||||
color: color.withOpacity(0.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user