Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
barcodes_scan.dart
Go to the documentation of this file.
1import 'package:flutter/material.dart';
2import 'package:flutter_screenutil/flutter_screenutil.dart';
3
4import '../../../../../../core/ui/theme/color_palette.dart';
5import 'scan_section/scan_section.dart';
6
7class BarCodesScan extends StatefulWidget {
8 final Function(String, String)? onScannedValuesChanged;
9
11 super.key,
12 this.onScannedValuesChanged,
13 });
14
15 @override
16 State<BarCodesScan> createState() => _BarCodesScanState();
17}
18
19class _BarCodesScanState extends State<BarCodesScan> {
20 List<DrumScan> recoveredDrums = [];
21 List<DrumScan> depositedDrums = [];
24
25 String _getFormattedDrumCodes(List<DrumScan> drums, bool isNotApplicable) {
26 if (isNotApplicable) {
27 return 'N/A';
28 }
29 return drums
30 .map((drum) => drum.drumCode.replaceFirst('DRUM-', ''))
31 .join(',');
32 }
33
34 void _updateRecoveredDrums(List<DrumScan> drums) {
35 setState(() {
36 recoveredDrums = drums;
38 });
39 }
40
41 void _updateDepositedDrums(List<DrumScan> drums) {
42 setState(() {
43 depositedDrums = drums;
45 });
46 }
47
48 void _updateRecoveredNotApplicable(bool isNotApplicable) {
49 setState(() {
50 isRecoveredNotApplicable = isNotApplicable;
52 });
53 }
54
55 void _updateDepositedNotApplicable(bool isNotApplicable) {
56 setState(() {
57 isDepositedNotApplicable = isNotApplicable;
59 });
60 }
61
63 if (widget.onScannedValuesChanged != null) {
64 widget.onScannedValuesChanged!(
67 );
68 }
69 }
70
71 @override
72 Widget build(BuildContext context) {
73 return Container(
74 margin: EdgeInsets.all(16.sp),
75 padding: EdgeInsets.all(16.sp),
76 decoration: BoxDecoration(
77 color: Colors.white,
78 borderRadius: BorderRadius.circular(20),
79 boxShadow: [
80 BoxShadow(
81 color: ColorPalette.black.withValues(alpha:0.05),
82 blurRadius: 10,
83 offset: const Offset(0, 4),
84 ),
85 ],
86 ),
88 crossAxisAlignment: CrossAxisAlignment.start,
89 children: [
90 ScanSection(
91 type: 'recovered',
92 onScannedDrumsChanged: _updateRecoveredDrums,
93 onNotApplicableChanged: _updateRecoveredNotApplicable,
94 ),
95 SizedBox(height: 16.sp),
96 ScanSection(
97 type: 'deposited',
98 onScannedDrumsChanged: _updateDepositedDrums,
99 onNotApplicableChanged: _updateDepositedNotApplicable,
100 ),
101 ],
102 ),
103 );
104 }
105}
class App extends StatefulWidget build(BuildContext context)
Definition app.dart:31
String _getFormattedDrumCodes(List< DrumScan > drums, bool isNotApplicable)
List< DrumScan > depositedDrums
void _updateRecoveredDrums(List< DrumScan > drums)
void _updateDepositedDrums(List< DrumScan > drums)
void _updateRecoveredNotApplicable(bool isNotApplicable)
void _updateDepositedNotApplicable(bool isNotApplicable)
void _notifyValuesChanged()
bool isDepositedNotApplicable
class BarCodesScan extends StatefulWidget recoveredDrums
bool isRecoveredNotApplicable
static const black
const BarCodesScan({ super.key, this.onScannedValuesChanged, })
override State< BarCodesScan > createState()
final Function(String, String)? onScannedValuesChanged
final String type
final Widget child
final EdgeInsets padding
class Partner String
final Color color
Definition failures.dart:1
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,),),),],)