Skip to content

Commit 2f4ae28

Browse files
authored
Merge pull request #79 from FRC2706/dev
Dev
2 parents 3c6d1b2 + e794138 commit 2f4ae28

4 files changed

Lines changed: 179 additions & 177 deletions

File tree

ios/Podfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PODS:
22
- Flutter (1.0.0)
33
- MTBBarcodeScanner (5.0.11)
4-
- qr_code_scanner (0.2.0):
4+
- qr_code_scanner_plus (0.2.6):
55
- Flutter
66
- MTBBarcodeScanner
77
- shared_preferences_foundation (0.0.1):
@@ -12,7 +12,7 @@ PODS:
1212

1313
DEPENDENCIES:
1414
- Flutter (from `Flutter`)
15-
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
15+
- qr_code_scanner_plus (from `.symlinks/plugins/qr_code_scanner_plus/ios`)
1616
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
1717
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
1818

@@ -23,8 +23,8 @@ SPEC REPOS:
2323
EXTERNAL SOURCES:
2424
Flutter:
2525
:path: Flutter
26-
qr_code_scanner:
27-
:path: ".symlinks/plugins/qr_code_scanner/ios"
26+
qr_code_scanner_plus:
27+
:path: ".symlinks/plugins/qr_code_scanner_plus/ios"
2828
shared_preferences_foundation:
2929
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
3030
url_launcher_ios:
@@ -33,7 +33,7 @@ EXTERNAL SOURCES:
3333
SPEC CHECKSUMS:
3434
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
3535
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
36-
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
36+
qr_code_scanner_plus: 3bfe4deb7f28996a63a2a580819d49dae80d5ed3
3737
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
3838
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
3939

lib/screens/pit_scouting.dart

Lines changed: 86 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -129,89 +129,96 @@ class _PitScoutingState extends State<PitScoutingPage> {
129129
),
130130
body: ListView.builder(
131131
padding: const EdgeInsets.all(8),
132-
itemCount: formFields['Pit']?.length ?? 0,
132+
itemCount: formFields['Pit']?.length + 1 ?? 0,
133133
itemBuilder: (BuildContext context, int index) {
134-
var field = formFields['Pit'][index];
135-
bool showError = fieldErrors[field['name']] ?? false;
136-
if (field['type'] == 'number') {
137-
return Column(
138-
children: [
139-
TextFormField(
140-
keyboardType: TextInputType.number,
141-
initialValue:
142-
textValues[field['name']] ?? '', // Use the stored value
143-
decoration: InputDecoration(
144-
labelText: field['name'],
145-
errorText: showError ? 'This field is required' : null,
146-
),
147-
onChanged: (value) {
148-
if (field['required'] && (value == null || value.isEmpty)) {
149-
fieldErrors[field['name']] = true;
150-
} else {
151-
fieldErrors[field['name']] = false;
152-
}
153-
textValues[field['name']] = value; // Update textValues
154-
setState(() {});
155-
},
156-
),
157-
],
158-
);
159-
} else if (field['type'] == 'text') {
160-
return Column(
161-
children: [
162-
TextFormField(
163-
initialValue:
164-
textValues[field['name']] ?? '', // Use the stored value
165-
decoration: InputDecoration(
166-
labelText: field['name'],
167-
errorText: showError ? 'This field is required' : null,
134+
if (index != formFields['Pit']?.length) {
135+
var field = formFields['Pit'][index];
136+
bool showError = fieldErrors[field['name']] ?? false;
137+
if (field['type'] == 'number') {
138+
return Column(
139+
children: [
140+
TextFormField(
141+
keyboardType: TextInputType.number,
142+
initialValue:
143+
textValues[field['name']] ?? '', // Use the stored value
144+
decoration: InputDecoration(
145+
labelText: field['name'],
146+
errorText: showError ? 'This field is required' : null,
147+
),
148+
onChanged: (value) {
149+
if (field['required'] &&
150+
(value == null || value.isEmpty)) {
151+
fieldErrors[field['name']] = true;
152+
} else {
153+
fieldErrors[field['name']] = false;
154+
}
155+
textValues[field['name']] = value; // Update textValues
156+
setState(() {});
157+
},
168158
),
169-
onChanged: (value) {
170-
if (field['required'] && (value == null || value.isEmpty)) {
171-
fieldErrors[field['name']] = true;
172-
} else {
173-
fieldErrors[field['name']] = false;
174-
}
175-
textValues[field['name']] = value; // Update textValues
176-
setState(() {});
177-
},
178-
),
179-
],
180-
);
181-
} else if (field['type'] == 'radio') {
182-
return Column(
183-
crossAxisAlignment: CrossAxisAlignment.start,
184-
children: [
185-
Text(
186-
field['name'],
187-
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
188-
),
189-
...field['choices'].map<Widget>((choice) {
190-
return ListTile(
191-
title: Text(choice),
192-
leading: Radio<String>(
193-
value: choice,
194-
groupValue: radioValues[field['name']],
195-
onChanged: (String? value) {
196-
if (value != null) {
197-
setState(() {
198-
radioValues[field['name']] = value;
199-
fieldErrors[field['name']] = false;
200-
});
201-
}
202-
},
159+
],
160+
);
161+
} else if (field['type'] == 'text') {
162+
return Column(
163+
children: [
164+
TextFormField(
165+
initialValue:
166+
textValues[field['name']] ?? '', // Use the stored value
167+
decoration: InputDecoration(
168+
labelText: field['name'],
169+
errorText: showError ? 'This field is required' : null,
203170
),
204-
);
205-
}).toList(),
206-
showError
207-
? Text('This field is required',
208-
style: TextStyle(color: Colors.red))
209-
: SizedBox.shrink(),
210-
],
211-
);
171+
onChanged: (value) {
172+
if (field['required'] &&
173+
(value == null || value.isEmpty)) {
174+
fieldErrors[field['name']] = true;
175+
} else {
176+
fieldErrors[field['name']] = false;
177+
}
178+
textValues[field['name']] = value; // Update textValues
179+
setState(() {});
180+
},
181+
),
182+
],
183+
);
184+
} else if (field['type'] == 'radio') {
185+
return Column(
186+
crossAxisAlignment: CrossAxisAlignment.start,
187+
children: [
188+
Text(
189+
field['name'],
190+
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
191+
),
192+
...field['choices'].map<Widget>((choice) {
193+
return ListTile(
194+
title: Text(choice),
195+
leading: Radio<String>(
196+
value: choice,
197+
groupValue: radioValues[field['name']],
198+
onChanged: (String? value) {
199+
if (value != null) {
200+
setState(() {
201+
radioValues[field['name']] = value;
202+
fieldErrors[field['name']] = false;
203+
});
204+
}
205+
},
206+
),
207+
);
208+
}).toList(),
209+
showError
210+
? Text('This field is required',
211+
style: TextStyle(color: Colors.red))
212+
: SizedBox.shrink(),
213+
],
214+
);
215+
} else {
216+
return SizedBox
217+
.shrink(); // Return an empty widget for unsupported field types
218+
}
212219
} else {
213-
return SizedBox
214-
.shrink(); // Return an empty widget for unsupported field types
220+
return Text(
221+
"Please send pictures of the robot to the scouting channel");
215222
}
216223
},
217224
),

0 commit comments

Comments
 (0)