@@ -21,114 +21,83 @@ class _ScannedDataPreviewRouteState extends State<ScannedDataPreviewRoute> {
21
21
@override
22
22
Widget build (BuildContext context) {
23
23
return PlatformRoute (
24
- title: widget.title,
25
- body: SingleChildScrollView (
26
- physics: const AlwaysScrollableScrollPhysics (),
27
- child: Column (children: [
28
- /**
29
- * PLEASE REFERENCE QRCodeHelper.dart FOR THE INDEXES OF THE DATA
30
- */
31
- Row (
32
- children: [
33
- Text ("Team Number: ${widget .data [0 ]}, " ,
34
- style: const TextStyle (fontSize: 18 )),
35
- Text ("Match Number: ${widget .data [1 ]}, " ,
36
- style: const TextStyle (fontSize: 18 )),
37
- Text ("Initials: ${widget .data [2 ]}, " ,
38
- style: const TextStyle (fontSize: 18 )),
39
- Text ("Driverstation: ${widget .data [3 ]}" ,
40
- style: const TextStyle (fontSize: 18 )),
41
- ],
24
+ title: widget.title,
25
+ body: Padding (
26
+ padding: const EdgeInsets .all (16.0 ),
27
+ child: ListView (
28
+ physics: const AlwaysScrollableScrollPhysics (),
29
+ children: [
30
+ _buildDataCard ("Team Number: ${widget .data [0 ]}" ),
31
+ _buildDataCard ("Match Number: ${widget .data [1 ]}" ),
32
+ _buildDataCard ("Initials: ${widget .data [2 ]}" ),
33
+ _buildDataCard ("Driver Station: ${widget .data [3 ]}" ),
34
+ _buildDataCard ("Auto Speaker Scored: ${widget .data [4 ]}" ),
35
+ _buildDataCard ("Auto Speaker Missed: ${widget .data [5 ]}" ),
36
+ _buildDataCard ("Auto Amp Scored: ${widget .data [6 ]}" ),
37
+ _buildDataCard ("Auto Amp Missed: ${widget .data [7 ]}" ),
38
+ _buildDataCard ("Auto Mobility: ${widget .data [8 ]}" ),
39
+ _buildDataCard ("Teleop Speaker Scored: ${widget .data [9 ]}" ),
40
+ _buildDataCard ("Teleop Speaker Missed: ${widget .data [10 ]}" ),
41
+ _buildDataCard ("Teleop Amp Scored: ${widget .data [11 ]}" ),
42
+ _buildDataCard ("Teleop Amp Missed: ${widget .data [12 ]}" ),
43
+ _buildDataCard ("Teleop Passes: ${widget .data [13 ]}" ),
44
+ _buildDataCard ("Teleop Endgame: ${widget .data [14 ]}" ),
45
+ _buildDataCard ("Teleop Climb Time: ${widget .data [15 ]}" ),
46
+ _buildDataCard ("Teleop Trap: ${widget .data [16 ]}" ),
47
+ _buildDataCard ("Auto Comments: ${widget .data [17 ]}" ),
48
+ _buildDataCard ("Auto Order: ${widget .data [18 ]}" ),
49
+ _buildDataCard ("Teleop Comments: ${widget .data [19 ]}" ),
50
+ _buildDataCard ("Endgame Comments: ${widget .data [20 ]}" ),
51
+ const SizedBox (height: 20 ), // Space before the button
52
+ ElevatedButton (
53
+ style: ElevatedButton .styleFrom (
54
+ backgroundColor: AppStyle .textInputColorLight,
55
+ padding: const EdgeInsets .symmetric (
56
+ vertical: 15.0 , horizontal: 20.0 ),
57
+ shape: RoundedRectangleBorder (
58
+ borderRadius: BorderRadius .circular (30.0 ),
59
+ ),
60
+ elevation: 5 ,
42
61
),
43
- Row (
44
- children: [
45
- Text ("Auto Speaker Scored: ${widget .data [4 ]}, " ,
46
- style: const TextStyle (fontSize: 18 )),
47
- Text ("Auto Speaker Missed: ${widget .data [5 ]}, " ,
48
- style: const TextStyle (fontSize: 18 )),
49
- Text ("Auto Amp Scored: ${widget .data [6 ]}, " ,
50
- style: const TextStyle (fontSize: 18 )),
51
- Text ("Auto Amp Missed: ${widget .data [7 ]}, " ,
52
- style: const TextStyle (fontSize: 18 )),
53
- Text ("Auto Mobility: ${widget .data [8 ]}" ,
54
- style: const TextStyle (fontSize: 18 )),
55
- ],
62
+ onPressed: () async {
63
+ setState (() {
64
+ ScanningHelper .unscannedDevices = ScanningHelper
65
+ .unscannedDevices
66
+ .where ((element) => ! element.contains (widget.data[21 ]))
67
+ .toList ();
68
+ if (! ScanningHelper .scannedDevices
69
+ .contains (widget.data[21 ])) {
70
+ ScanningHelper .scannedDevices.add (widget.data[21 ]);
71
+ }
72
+ });
73
+ Navigator .push (context, MaterialPageRoute (builder: (context) {
74
+ return const DriverStationScanStatusRoute (
75
+ title: "Scanned Status" ,
76
+ );
77
+ }));
78
+ await ScanningHelper .generateCsv (widget.data);
79
+ },
80
+ child: const Text (
81
+ 'Save QR Code Data' ,
82
+ style: TextStyle (fontSize: 16.0 , color: Colors .white),
56
83
),
57
- Row (
58
- children: [
59
- Text ("Teleop Speaker Scored: ${widget .data [9 ]}, " ,
60
- style: const TextStyle (fontSize: 18 )),
61
- Text ("Teleop Speaker Missed: ${widget .data [10 ]}, " ,
62
- style: const TextStyle (fontSize: 18 )),
63
- Text ("Teleop Amp Scored: ${widget .data [11 ]}, " ,
64
- style: const TextStyle (fontSize: 18 )),
65
- Text ("Teleop Amp Missed: ${widget .data [12 ]}, " ,
66
- style: const TextStyle (fontSize: 18 )),
67
- ],
68
- ),
69
- Row (
70
- children: [
71
- Text ("Teleop Passes: ${widget .data [13 ]}" ,
72
- style: const TextStyle (fontSize: 18 )),
73
- Text ("Teleop Endgame: ${widget .data [14 ]}" ,
74
- style: const TextStyle (fontSize: 18 )),
75
- Text ("Teleop Climb Time: ${widget .data [15 ]}, " ,
76
- style: const TextStyle (fontSize: 18 )),
77
- Text ("Teleop Trap: ${widget .data [16 ]}, " ,
78
- style: const TextStyle (fontSize: 18 )),
79
- ],
80
- ),
81
- Row (
82
- children: [
83
- Text ("Auto Comments: ${widget .data [17 ]}, " ,
84
- style: const TextStyle (fontSize: 18 )),
85
- Text ("Auto Order: ${widget .data [18 ]}, " ,
86
- style: const TextStyle (fontSize: 18 )),
87
- Text ("Teleop Comments: ${widget .data [19 ]}, " ,
88
- style: const TextStyle (fontSize: 18 )),
89
- Text ("Endgame Comments: ${widget .data [20 ]}" ,
90
- style: const TextStyle (fontSize: 18 ))
91
- ],
92
- ),
93
- Row (
94
- children: [
95
- ElevatedButton (
96
- style: ElevatedButton .styleFrom (
97
- backgroundColor: AppStyle
98
- .textInputColorLight, // Set the background color here
99
- ),
100
- onPressed: () async {
101
- setState (() {
102
- ScanningHelper .unscannedDevices = ScanningHelper
103
- .unscannedDevices
104
- .where ((element) => ! element.contains (
105
- widget.data[21 ]))
106
- .toList ();
107
- if (! ScanningHelper .scannedDevices.contains (
108
- widget.data[21 ])) {
109
- ScanningHelper .scannedDevices
110
- .add (widget.data[21 ]);
111
- }
112
- });
113
- Navigator .push (context,
114
- MaterialPageRoute (builder: (context) {
115
- return const DriverStationScanStatusRoute (
116
- title: "Scanned Status" ,
117
- );
118
- }));
119
- await ScanningHelper .generateCsv (
120
- widget.data);
121
- },
122
- child: const Text (
123
- 'Save QR Code Data' ,
124
- style: TextStyle (
125
- fontSize: 16.0 ,
126
- fontFamily: "Helvetica" ,
127
- color: Colors .white),
128
- ),
129
- ),
130
- ],
131
- )
132
- ])));
84
+ ),
85
+ ],
86
+ ),
87
+ ),
88
+ );
89
+ }
90
+
91
+ Widget _buildDataCard (String text) {
92
+ return Card (
93
+ margin: const EdgeInsets .symmetric (vertical: 8.0 ),
94
+ child: Padding (
95
+ padding: const EdgeInsets .all (16.0 ),
96
+ child: Text (
97
+ text,
98
+ style: const TextStyle (fontSize: 18 ),
99
+ ),
100
+ ),
101
+ );
133
102
}
134
103
}
0 commit comments