Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
unloading_collection_item.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';
5import '../../../../../core/common/enums/collection_status.dart';
6import '../../../../../core/ui/theme/color_palette.dart';
7import '../../../../../core/ui/widgets/collection_badges/collection_status_badge.dart';
8import '../../../../../core/ui/widgets/collection_item/collection_info_row.dart';
9import '../../../domain/entities/unloading_collection_entity.dart';
10
11class UnloadingCollectionItem extends StatefulWidget {
14 final Function(bool?)? onCheckboxChanged;
15 final bool isSelected;
16
18 super.key,
19 required this.collection,
20 required this.number,
21 this.onCheckboxChanged,
22 required this.isSelected,
23 });
24
25 @override
26 State<UnloadingCollectionItem> createState() => _UnloadingCollectionItemState();
27}
28
29class _UnloadingCollectionItemState extends State<UnloadingCollectionItem> {
30 bool isSelected = false;
31
32 @override
33 Widget build(BuildContext context) {
34 return Container(
35 margin: EdgeInsets.fromLTRB(16.sp, 8.sp, 16.sp, 8.sp),
36 decoration: BoxDecoration(
38 borderRadius: BorderRadius.circular(20),
39 boxShadow: [
40 BoxShadow(
41 color: ColorPalette.black.withValues(alpha:0.04),
42 blurRadius: 15,
43 offset: const Offset(0, 5),
44 ),
45 ],
46 ),
48 children: [
49 Padding(
50 padding: EdgeInsets.all(16.sp),
51 child: Row(
52 children: [
53 Padding(
54 padding: EdgeInsets.only(right: 12.sp),
55 child: Checkbox(
56 value: widget.isSelected,
57 onChanged: widget.onCheckboxChanged,
58 shape: RoundedRectangleBorder(
59 borderRadius: BorderRadius.circular(4),
60 ),
61 side: BorderSide(width: 1.5, color: Colors.grey[400]!),
62 ),
63 ),
64 Expanded(
66 crossAxisAlignment: CrossAxisAlignment.start,
67 children: [
68 Text(
69 widget.collection.restaurant ?? "--",
70 style: Theme.of(context).textTheme.titleMedium!.copyWith(
72 fontWeight: FontWeight.w500,
73 ),
74 ),
75 SizedBox(height: 4.sp),
76 Text(
77 "${'unloading.collection_info.unloaded_on'.tr()} ${widget.collection.collectionDate?.toLocal().toString().split(' ')[0]}",
78 style: Theme.of(context).textTheme.titleSmall!.copyWith(
80 ),
81 ),
82 SizedBox(height: 4.sp),
83 ],
84 ),
85 ),
86 const CollectionStatusBadge(
87 status: CollectionStatus.notYetUnloaded,
88 ),
89 ],
90 ),
91 ),
92 Divider(height: 1.sp),
93 Padding(
94 padding: EdgeInsets.all(16.sp),
96 children: [
97 CollectionInfoRow(
98 label: 'unloading.collection_info.address'.tr(),
99 value: widget.collection.address ?? "--",
100 icon: FluentIcons.location_12_regular,
101 ),
102 SizedBox(height: 12.sp),
103 CollectionInfoRow(
104 label: 'unloading.collection_info.collected_quantity'.tr(),
105 value: formatVolume(widget.collection.volumeCollected),
106 icon: FluentIcons.drop_12_regular,
107 )
108 ],
109 ),
110 ),
111 ],
112 ),
113 );
114 }
115
116 String formatVolume(dynamic volume) {
117 if (volume == null) return "--";
118 double volumeValue = volume is double ? volume : double.tryParse(volume.toString()) ?? 0.0;
119 if (volumeValue > 999) {
120 return '${(volumeValue / 1000).toStringAsFixed(2)} MT';
121 } else {
122 return '$volumeValue KG';
123 }
124 }
125}
class App extends StatefulWidget build(BuildContext context)
Definition app.dart:31
static const darkGrey
static const black
static const white
static const grey
final UnloadingCollectionEntity collection
const UnloadingCollectionItem({ super.key, required this.collection, required this.number, this.onCheckboxChanged, required this.isSelected, })
final Function(bool?)? onCheckboxChanged
override State< UnloadingCollectionItem > createState()
CollectionStatus
final Widget child
final EdgeInsets padding
class Partner String
final Color color
Definition failures.dart:1
class UnloadingCollectionItem extends StatefulWidget isSelected
String formatVolume(dynamic volume)
final String label
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,),),),],)