Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
details_card.dart
Go to the documentation of this file.
1import 'package:easy_localization/easy_localization.dart';
2import 'package:fluentui_system_icons/fluentui_system_icons.dart';
3import 'package:flutter/material.dart';
4import 'package:flutter_screenutil/flutter_screenutil.dart';
5
6// import '../../../../../../../core/constants/factors.dart';
7import 'detail_item.dart';
8
9class DetailsCard extends StatefulWidget {
11 final double volumeDeclared;
12 final double volumeCollected;
13 final Function(String) onVolumeCollectedChanged;
14
16 super.key,
17 required this.cvReference,
18 required this.volumeDeclared,
19 required this.volumeCollected,
20 required this.onVolumeCollectedChanged,
21 });
22
23 @override
24 State<DetailsCard> createState() => _DetailsCardState();
25}
26
27class _DetailsCardState extends State<DetailsCard> {
29
30 void _handleVolumeChange(String newValue) {
31 // Remove this line and uncomment
32 // the lines below to enable the validation of the volume collected
33 widget.onVolumeCollectedChanged(newValue);
34
35 // final double? inputValue = double.tryParse(newValue);
36
37 // if (inputValue != null) {
38 // final double minAllowed = widget.volumeDeclared * Factors.minCollectedQuantity;
39 // final double maxAllowed = widget.volumeDeclared * Factors.maxCollectedQuantity;
40
41 // setState(() {
42 // if (inputValue < minAllowed) {
43 // errorMessage = 'Volume cannot be less than ${minAllowed.toStringAsFixed(2)} KG';
44 // } else if (inputValue > maxAllowed) {
45 // errorMessage = 'Volume cannot exceed ${maxAllowed.toStringAsFixed(2)} KG';
46 // } else {
47 // errorMessage = null;
48 // }
49 // widget.onVolumeCollectedChanged(newValue);
50 // });
51 // }
52 }
53
54 @override
55 Widget build(BuildContext context) {
56 return Container(
57 margin: EdgeInsets.symmetric(horizontal: 16.sp),
58 padding: EdgeInsets.all(20.sp),
59 decoration: BoxDecoration(
60 color: Colors.white,
61 borderRadius: BorderRadius.circular(20),
62 boxShadow: [
63 BoxShadow(
64 color: Colors.black.withValues(alpha: 0.05),
65 blurRadius: 10,
66 offset: const Offset(0, 4),
67 ),
68 ],
69 ),
71 crossAxisAlignment: CrossAxisAlignment.start,
72 children: [
73 DetailItem(
74 title: 'information.cv_reference'.tr(),
75 value: widget.cvReference,
76 isReference: true,
77 icon: Icons.description_outlined,
78 ),
79 SizedBox(height: 24.sp),
80 Row(
81 children: [
82 Expanded(
83 child: DetailItem(
84 title: 'information.qty_declared'.tr(),
85 subtitle: 'In KG',
86 value: '${widget.volumeDeclared}',
87 icon: FluentIcons.drop_12_regular,
88 ),
89 ),
90 SizedBox(width: 16.sp),
91 Expanded(
92 child: DetailItem(
93 title: 'information.qty_collected'.tr(),
94 subtitle: 'In KG',
95 value: '${widget.volumeCollected}',
96 icon: FluentIcons.drop_12_filled,
97 isEditable: true,
98 onValueChanged: _handleVolumeChange,
99 ),
100 ),
101 ],
102 ),
103 // if (errorMessage != null) ...[
104 // SizedBox(height: 8.sp),
105 // Text(
106 // errorMessage!,
107 // style: TextStyle(
108 // color: Colors.red,
109 // fontSize: 12.sp,
110 // fontWeight: FontWeight.w500,
111 // ),
112 // ),
113 // ],
114 ],
115 ),
116 );
117 }
118}
class App extends StatefulWidget build(BuildContext context)
Definition app.dart:31
String errorMessage
final Function(String) onVolumeCollectedChanged
override State< DetailsCard > createState()
final String cvReference
final double volumeDeclared
const DetailsCard({ super.key, required this.cvReference, required this.volumeDeclared, required this.volumeCollected, required this.onVolumeCollectedChanged, })
final double volumeCollected
final Widget child
final EdgeInsets padding
final String subtitle
class Partner String
void _handleVolumeChange(String newValue)
final Color color
Definition failures.dart:1
final String title
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,),),),],)