Aidra Connect 10.0.2+16
Aidra Connect Mobile Application
Loading...
Searching...
No Matches
transaction_card.dart
Go to the documentation of this file.
1import 'package:connect/core/localization/app_localizations.dart';
2
3import '../../../../../../../../../../core/utils/number_conversion.dart';
4import '/features/collections/domain/entities/collection_entity.dart';
5import '/features/collections/presentation/screens/transaction_history_screen/views/competed_transactions_view/views/transactions_summary_view/widgets/transaction_card_details.dart';
6import 'package:flutter/material.dart';
7import 'package:flutter_screenutil/flutter_screenutil.dart';
8import 'package:hugeicons/hugeicons.dart';
9
10import 'package:intl/intl.dart';
11
12class TransactionCard extends StatelessWidget {
14 super.key,
15 required this.collection,
16 this.showToBePaidLabel = false,
17 });
18
21
22 @override
23 Widget build(BuildContext context) {
24 return ElevatedButton(
25 style: ElevatedButton.styleFrom(
26 backgroundColor: Colors.transparent,
27 padding: EdgeInsets.symmetric(horizontal: 10.sp, vertical: 15.sp),
28 ),
29 onPressed: () {
30 showModalBottomSheet(
31 context: context,
32 backgroundColor: Colors.transparent,
33 isScrollControlled: true,
34 elevation: 0.0,
35 builder: (BuildContext context) {
36 return Padding(
37 padding: EdgeInsets.all(10.sp),
38 child: TransactionCardDetails(collection: collection),
39 );
40 },
41 );
42 },
43 child: Table(
44 columnWidths: const {
45 0: FixedColumnWidth(65),
46 1: FixedColumnWidth(10),
47 3: FixedColumnWidth(100),
48 },
49 defaultVerticalAlignment: TableCellVerticalAlignment.middle,
50 children: [
51 TableRow(
52 children: [
53 Text(
54 NumberConversionService.convertAndFormatWeight(
55 collection.orderLines?.first.productQty),
56 // '${NumberFormat.compact().format(collection.orderLines?.first.productQty)} Kg',
57 style: Theme.of(context).textTheme.displaySmall?.copyWith(
58 color: Theme.of(context).colorScheme.primary,
59 fontWeight: FontWeight.bold,
60 fontSize: 13.5.sp,
61 ),
62 ),
63 SizedBox(
64 height: 30.sp,
65 child: const VerticalDivider(),
66 ),
67 Padding(
68 padding: EdgeInsets.symmetric(horizontal: 10.sp),
69 child: Column(
70 crossAxisAlignment: CrossAxisAlignment.start,
71 children: [
72 Text(
73 '${collection.name}',
74 style: Theme.of(context).textTheme.bodySmall?.copyWith(
75 fontSize: 13.sp,
76 ),
77 ),
78 SizedBox(height: 3.sp),
79 Text(
80 collection.dateOrder == null
81 ? ''
82 : DateFormat('MMM d, y')
83 .format(collection.dateOrder!),
84 style: Theme.of(context).textTheme.bodySmall?.copyWith(
85 fontSize: 10.5.sp,
86 color: Theme.of(context)
87 .colorScheme
88 .onSurface
89 .withOpacity(0.7),
90 ),
91 ),
92 ],
93 ),
94 ),
95 Padding(
96 padding: EdgeInsets.symmetric(horizontal: 5.sp),
97 child: Column(
98 crossAxisAlignment: CrossAxisAlignment.end,
99 children: [
101 total:
102 collection.orderLines?.first.productQty?.toDouble() ??
103 0,
104 actual: collection.orderLines?.first.qtyReceived
105 ?.toDouble() ??
106 0,
107 ),
108 SizedBox(height: 10.sp),
109 Opacity(
110 opacity: 0.7,
111 child: showToBePaidLabel
112 ? Text(
113 AppLocalizations.of(context)
114 .translate('To be paid'),
115 style: Theme.of(context)
116 .textTheme
117 .bodySmall
118 ?.copyWith(
119 color: Theme.of(context).hintColor,
120 fontSize: 10.sp,
121 ),
122 )
123 : Row(
124 mainAxisSize: MainAxisSize.min,
125 children: [
126 Text(
127 AppLocalizations.of(context)
128 .translate('show more'),
129 style: Theme.of(context)
130 .textTheme
131 .bodySmall
132 ?.copyWith(
133 fontSize: 8.sp,
134 color: Theme.of(context)
135 .colorScheme
136 .onSurface,
137 ),
138 ),
139 SizedBox(width: 5.sp),
140 Icon(
141 HugeIcons.strokeRoundedArrowRight02,
142 color:
143 Theme.of(context).colorScheme.onSurface,
144 size: 12.sp,
145 ),
146 ],
147 ),
148 ),
149 ],
150 ),
151 ),
152 ],
153 ),
154 ],
155 ),
156 );
157 }
158}
159
161 final double actual;
162 final double total;
163
165 super.key,
166 required this.actual,
167 required this.total,
168 });
169
170 @override
171 Widget build(BuildContext context) {
172 double percentage = (actual / total).clamp(0.0, 1.0);
173
174 return Row(
175 mainAxisAlignment: MainAxisAlignment.end,
176 crossAxisAlignment: CrossAxisAlignment.center,
177 children: [
178 SizedBox(
179 width: 50.sp,
180 child: LinearProgressIndicator(
182 minHeight: 2,
184 Theme.of(context).colorScheme.primary.withOpacity(0.11),
185 valueColor: AlwaysStoppedAnimation<Color>(
186 Theme.of(context).colorScheme.primary,
187 ),
188 ),
189 ),
190 SizedBox(width: 7.sp),
191 Text(
192 '${(percentage * 100).toStringAsFixed(0)}%',
193 style: Theme.of(context).textTheme.displaySmall?.copyWith(
194 fontSize: 7.5.sp,
195 ),
196 ),
197 ],
198 );
199 }
200}
AppLocalizations(this.locale)
class CalenderTransactionsSummaryVeiw extends StatefulWidget collection
final bool showToBePaidLabel
final VoidCallback onPressed
override Widget build(BuildContext context)
final CollectionEntity collection
const TransactionCard({ super.key, required this.collection, this.showToBePaidLabel=false, })
final Widget child
final EdgeInsets padding
final Color backgroundColor
final double percentage
final Color color
Definition failures.dart:1
final double value
class TransactionCard extends StatelessWidget actual
final double total
const PercentageProgressBar({ super.key, required this.actual, required this.total, })