Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
statistics_card.dart
Go to the documentation of this file.
1import 'package:fluentui_system_icons/fluentui_system_icons.dart';
2import 'package:flutter/material.dart';
3import 'package:flutter_screenutil/flutter_screenutil.dart';
4
5import '../../../../../core/ui/theme/color_palette.dart';
6
7class StatisticsCard extends StatelessWidget {
9 final int totalCollections;
10 final double doneVolume;
11 final double totalVolume;
12 final int visitedStops;
13 final int totalStops;
14
16 super.key,
17 required this.collectionNumbersDone,
18 required this.totalCollections,
19 required this.doneVolume,
20 required this.totalVolume,
21 required this.visitedStops,
22 required this.totalStops,
23 });
24
25 @override
26 Widget build(BuildContext context) {
27 return Container(
28 decoration: BoxDecoration(
30 borderRadius: BorderRadius.circular(24),
31 boxShadow: [
32 BoxShadow(
33 color: ColorPalette.black.withValues(alpha: 0.05),
34 blurRadius: 20,
35 offset: const Offset(0, 10),
36 ),
37 ],
38 ),
39 child: Row(
40 crossAxisAlignment: CrossAxisAlignment.start,
41 children: [
42 Expanded(
44 "TOTAL EXECUTED",
45 collectionNumbersDone.toString(),
46 totalCollections.toString(),
47 "Assigned",
48 "${formatWeight(doneVolume)} / ${formatWeight(totalVolume)}",
49 FluentIcons.textbox_rotate_90_20_filled,
50 ),
51 ),
52 const SizedBox(width: 6),
53 // Container divider
54 Container(
55 width: 1,
56 height: 230.sp,
57 color: ColorPalette.grey.withValues(alpha: 0.2),
58 ),
59 const SizedBox(width: 6),
60 Expanded(
62 "TOTAL VISITED STOPS",
63 visitedStops.toString(),
64 totalStops.toString(),
65 "Assigned",
66 "",
67 FluentIcons.location_12_regular,
68 ),
69 ),
70 ],
71 ),
72 );
73 }
74
77 String current,
78 String total,
80 String secondaryValue,
81 IconData icon,
82 ) {
83 return Container(
84 padding: const EdgeInsets.all(20),
86 crossAxisAlignment: CrossAxisAlignment.start,
87 children: [
88 Container(
89 padding: const EdgeInsets.all(12),
90 decoration: BoxDecoration(
91 color: ColorPalette.lightGreen.withValues(alpha: 0.1),
92 borderRadius: BorderRadius.circular(12),
93 ),
94 child: Icon(
95 icon,
97 size: 24,
98 ),
99 ),
100 const SizedBox(height: 16),
101 Text(
102 title,
103 style: const TextStyle(
105 fontSize: 12,
106 letterSpacing: 0.5,
107 ),
108 ),
109 const SizedBox(height: 8),
110 Row(
111 crossAxisAlignment: CrossAxisAlignment.end,
112 children: [
113 Text(
114 current,
115 style: const TextStyle(
116 fontSize: 28,
117 fontWeight: FontWeight.bold,
119 ),
120 ),
121 Text(
122 "/$total",
123 style: const TextStyle(
124 fontSize: 20,
126 ),
127 ),
128 ],
129 ),
130 const SizedBox(height: 4),
131 Text(
132 subtitle,
133 style: const TextStyle(
135 fontSize: 14,
136 ),
137 ),
138 if (secondaryValue.isNotEmpty) ...[
139 const SizedBox(height: 12),
140 Container(
141 padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
142 decoration: BoxDecoration(
143 color: ColorPalette.blue.withValues(alpha: 0.1),
144 borderRadius: BorderRadius.circular(8),
145 ),
146 child: Text(
147 secondaryValue,
148 style: const TextStyle(
150 fontSize: 11,
151 fontWeight: FontWeight.w500,
152 ),
153 ),
154 ),
155 ],
156 ],
157 ),
158 );
159 }
160
161 // Helper method to format weight values
162 String formatWeight(double weight) {
163 if (weight >= 1000) {
164 // Convert to metric tons and format with 2 decimal places
165 return "${(weight / 1000).toStringAsFixed(2)} MT";
166 } else {
167 // Keep as kg
168 return "${weight.toStringAsFixed(0)} KG";
169 }
170 }
171}
static const darkGrey
static const lightGreen
static const black
static const white
static const blue
static const grey
final int collectionNumbersDone
final double doneVolume
final String title
final Widget child
override Widget build(BuildContext context)
Widget _buildStatCard(String title, String current, String total, String subtitle, String secondaryValue, IconData icon,)
final EdgeInsets padding
final int totalCollections
final double totalVolume
String formatWeight(double weight)
final String subtitle
const StatisticsCard({ super.key, required this.collectionNumbersDone, required this.totalCollections, required this.doneVolume, required this.totalVolume, required this.visitedStops, required this.totalStops, })
class Partner String
style Text( '${ 'scheduling.reference'.tr()}:${collection.internalCode}', style:Theme.of(context).textTheme.bodySmall,)
style SizedBox(height:2.h)
style Column(crossAxisAlignment:CrossAxisAlignment.end, children:[Container(padding:EdgeInsets.symmetric(horizontal:8.w, vertical:4.h), decoration:BoxDecoration(color:ColorPalette.tiffanyBlue.withValues(alpha:0.1), borderRadius:BorderRadius.circular(12),), child:Text(collection.type ?? '', style:Theme.of(context).textTheme.bodySmall?.copyWith(color:ColorPalette.tiffanyBlue, fontWeight:FontWeight.bold,),),),],)