Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
monthly_collection_performance_card.dart
Go to the documentation of this file.
1import 'package:connect/core/localization/app_localizations.dart';
2import 'package:connect/core/utils/number_conversion.dart';
3
4import '../../../../../core/constants/app_values.dart';
5import '/core/ui/widgets/custom_card.dart';
6import 'package:flutter/material.dart';
7import 'package:flutter_screenutil/flutter_screenutil.dart';
8import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
9import 'package:intl/intl.dart';
10import 'package:percent_indicator/circular_percent_indicator.dart';
11
12class MonthlyCollectionsPerformanceCard extends StatelessWidget {
14 super.key,
15 required this.volumeDeclared,
16 required this.volumeCollected,
17 required this.collectionNumbers,
18 required this.declaredvsCollected,
19 required this.wastPerformance,
20 });
21
22 final num? volumeCollected;
23 final num? volumeDeclared;
26 final num? wastPerformance;
27
28 @override
29 Widget build(BuildContext context) {
30 print(volumeDeclared);
31 return CustomCard(
32 child: Column(
33 crossAxisAlignment: CrossAxisAlignment.start,
34 children: [
35 Text(
36 AppLocalizations.of(context)
37 .translate('MONTHLY COLLECTION PERFORMANCE'),
38 style: Theme.of(context).textTheme.bodySmall,
39 ),
40 SizedBox(height: 10.sp),
41 StaggeredGrid.count(
42 axisDirection: AxisDirection.down,
43 crossAxisCount: 2,
44 mainAxisSpacing: 10.sp,
45 crossAxisSpacing: 10.sp,
46 children: [
48 title:
49 '${NumberConversionService.convertAndFormatWeight(volumeDeclared)} / ${NumberConversionService.convertAndFormatWeight(volumeDeclared)}',
51 .translate('Declared vs Collected'),
52 context: context,
53 ),
55 title: NumberFormat.compact().format(collectionNumbers ?? 0),
56 subtitle: AppLocalizations.of(context).translate('Collections'),
57 context: context,
58 ),
59 const Divider(
60 height: 0.0,
61 ),
62 const Divider(
63 height: 0.0,
64 ),
66 label: AppLocalizations.of(context)
67 .translate('Declared VS Collected Performance'),
68 context: context,
70 ),
72 label: AppLocalizations.of(context)
73 .translate('Waste Management Performance'),
74 context: context,
76 ),
77 ],
78 ),
79 ],
80 ),
81 );
82 }
83
85 required String title,
86 required String subtitle,
87 required BuildContext context,
88 }) {
89 return Container(
90 padding: EdgeInsets.all(10.sp),
91 decoration: BoxDecoration(
92 borderRadius: BorderRadius.circular(10),
93 ),
94 child: Column(
95 mainAxisSize: MainAxisSize.min,
96 crossAxisAlignment: CrossAxisAlignment.center,
97 children: [
98 Text(
99 title,
100 style: Theme.of(context).textTheme.displaySmall?.copyWith(
101 color: Theme.of(context).colorScheme.primary,
102 fontWeight: FontWeight.bold,
103 fontSize: 14.sp,
104 ),
105 ),
106 SizedBox(height: 7.sp),
107 Text(
108 subtitle,
109 textAlign: TextAlign.center,
110 style: Theme.of(context).textTheme.bodySmall?.copyWith(
111 fontSize: 10.sp,
112 color: Theme.of(context).hintColor,
113 ),
114 ),
115 ],
116 ),
117 );
118 }
119
121 required String label,
122 required BuildContext context,
123 required num percentage,
124 }) {
125 double percentageValue = (percentage > 100) ? 100.0 : percentage.toDouble();
126 percentageValue = percentageValue / 100.0;
127
128 return Container(
129 padding: EdgeInsets.all(10.sp),
130 decoration: BoxDecoration(
131 borderRadius: BorderRadius.circular(10),
132 ),
133 child: Column(
134 crossAxisAlignment: CrossAxisAlignment.center,
135 children: [
136 CircularPercentIndicator(
137 radius: 25.sp,
138 lineWidth: 4,
139 percent: percentageValue,
140 center: Text(
141 '${(percentageValue * 100).toStringAsFixed(0)}%',
142 style: Theme.of(context).textTheme.bodySmall?.copyWith(
143 fontSize: 10.sp,
144 ),
145 ),
146 progressColor: Theme.of(context).colorScheme.primary,
148 Theme.of(context).colorScheme.primary.withOpacity(0.11),
149 ),
150 SizedBox(height: 10.sp),
151 Text(
152 label,
153 textAlign: TextAlign.center,
154 style: Theme.of(context).textTheme.bodySmall?.copyWith(
155 fontSize: 10.sp,
156 color: Theme.of(context).hintColor,
157 ),
158 ),
159 ],
160 ),
161 );
162 }
163}
String translate(String key)
static AppLocalizations of(BuildContext context)
Widget _buildPercentageInfoLabel({ required String label, required BuildContext context, required num received, required num qty, })
final String title
const CustomCard({ super.key, required this.child, this.padding, this.bgColor, })
final Widget child
override Widget build(BuildContext context)
final String label
Widget _buildPercentageInfoLabel({ required String label, required BuildContext context, required num percentage, })
_buildInfoCard({ required String title, required String subtitle, required BuildContext context, })
final String subtitle
const MonthlyCollectionsPerformanceCard({ super.key, required this.volumeDeclared, required this.volumeCollected, required this.collectionNumbers, required this.declaredvsCollected, required this.wastPerformance, })
final Widget child
final EdgeInsets padding
final Color backgroundColor
final Color progressColor
final double percentage
final String label
final Color color
Definition failures.dart:1
final String title