From ad735b315e8df6b237f1cee4a53c195e1a3bb215 Mon Sep 17 00:00:00 2001 From: ryanidk <46634687+ryanidk@users.noreply.github.com> Date: Sun, 16 Mar 2025 20:00:02 -0400 Subject: [PATCH 1/4] update version --- ios/Podfile.lock | 10 +++--- pubspec.lock | 86 ++++++++++++++++++++++-------------------------- pubspec.yaml | 2 +- 3 files changed, 45 insertions(+), 53 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 7154b01..ab7d1af 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,7 +1,7 @@ PODS: - Flutter (1.0.0) - MTBBarcodeScanner (5.0.11) - - qr_code_scanner (0.2.0): + - qr_code_scanner_plus (0.2.6): - Flutter - MTBBarcodeScanner - shared_preferences_foundation (0.0.1): @@ -12,7 +12,7 @@ PODS: DEPENDENCIES: - Flutter (from `Flutter`) - - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) + - qr_code_scanner_plus (from `.symlinks/plugins/qr_code_scanner_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) @@ -23,8 +23,8 @@ SPEC REPOS: EXTERNAL SOURCES: Flutter: :path: Flutter - qr_code_scanner: - :path: ".symlinks/plugins/qr_code_scanner/ios" + qr_code_scanner_plus: + :path: ".symlinks/plugins/qr_code_scanner_plus/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" url_launcher_ios: @@ -33,7 +33,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb - qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e + qr_code_scanner_plus: 3bfe4deb7f28996a63a2a580819d49dae80d5ed3 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe diff --git a/pubspec.lock b/pubspec.lock index 2500535..e9f875e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -69,10 +69,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.8" fake_async: dependency: transitive description: @@ -106,10 +106,10 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "5.0.0" flutter_svg: dependency: "direct main" description: @@ -132,10 +132,10 @@ packages: dependency: transitive description: name: google_identity_services_web - sha256: "9482364c9f8b7bd36902572ebc3a7c2b5c8ee57a9c93e6eb5099c1a9ec5265d8" + sha256: "55580f436822d64c8ff9a77e37d61f5fb1e6c7ec9d632a43ee324e2a05c3c6c9" url: "https://pub.dev" source: hosted - version: "0.3.1+1" + version: "0.3.3" googleapis: dependency: transitive description: @@ -164,10 +164,10 @@ packages: dependency: transitive description: name: http - sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" + sha256: fe7ab022b76f3034adc518fb6ea04a82387620e19977665ea18d30a1cf43442f url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" http_parser: dependency: transitive description: @@ -176,14 +176,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" leak_tracker: dependency: transitive description: @@ -212,10 +204,10 @@ packages: dependency: transitive description: name: lints - sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "5.1.1" matcher: dependency: transitive description: @@ -312,14 +304,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.1" - qr_code_scanner: + qr_code_scanner_plus: dependency: "direct main" description: - name: qr_code_scanner - sha256: f23b68d893505a424f0bd2e324ebea71ed88465d572d26bb8d2e78a4749591fd + name: qr_code_scanner_plus + sha256: "39696b50d277097ee4d90d4292de36f38c66213a4f5216a06b2bdd2b63117859" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "2.0.10+1" qr_flutter: dependency: "direct main" description: @@ -332,58 +324,58 @@ packages: dependency: "direct main" description: name: shared_preferences - sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02" + sha256: "846849e3e9b68f3ef4b60c60cf4b3e02e9321bc7f4d8c4692cf87ffa82fc8a3a" url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.5.2" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" + sha256: "3ec7210872c4ba945e3244982918e502fa2bfb5230dff6832459ca0e1879b7ad" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.4.8" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.5.4" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a" + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.3" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" sky_engine: dependency: transitive description: flutter @@ -449,10 +441,10 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e" + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.3.1" url_launcher_android: dependency: transitive description: @@ -462,13 +454,13 @@ packages: source: hosted version: "6.3.0" url_launcher_ios: - dependency: transitive + dependency: "direct main" description: name: url_launcher_ios - sha256: "9149d493b075ed740901f3ee844a38a00b33116c7c5c10d7fb27df8987fb51d5" + sha256: "16a513b6c12bb419304e72ea0ae2ab4fed569920d1c7cb850263fe3acc824626" url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.3.2" url_launcher_linux: dependency: transitive description: @@ -497,10 +489,10 @@ packages: dependency: transitive description: name: url_launcher_web - sha256: "3692a459204a33e04bc94f5fb91158faf4f2c8903281ddd82915adecdb1a901d" + sha256: "3ba963161bd0fe395917ba881d320b9c4f6dd3c4a233da62ab18a5025c85f1e9" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.0" url_launcher_windows: dependency: transitive description: @@ -553,10 +545,10 @@ packages: dependency: transitive description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "1.1.1" win32: dependency: transitive description: @@ -582,5 +574,5 @@ packages: source: hosted version: "6.5.0" sdks: - dart: ">=3.4.0 <4.0.0" - flutter: ">=3.19.0" + dart: ">=3.6.0 <4.0.0" + flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml index 9ead1a4..750dfe0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.1.0+1 +version: 1.1.1+1 environment: sdk: ">=3.2.3 <4.0.0" From b0993a392b5e7265078a8f7cff717f261b96c4d6 Mon Sep 17 00:00:00 2001 From: ryanidk <46634687+ryanidk@users.noreply.github.com> Date: Sun, 16 Mar 2025 20:02:19 -0400 Subject: [PATCH 2/4] add a dependency override to fix ios build issue --- pubspec.lock | 6 +++--- pubspec.yaml | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index e9f875e..f053a20 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -550,13 +550,13 @@ packages: source: hosted version: "1.1.1" win32: - dependency: transitive + dependency: "direct overridden" description: name: win32 - sha256: "8cb58b45c47dcb42ab3651533626161d6b67a2921917d8d429791f76972b3480" + sha256: "68d1e89a91ed61ad9c370f9f8b6effed9ae5e0ede22a270bdfa6daf79fc2290a" url: "https://pub.dev" source: hosted - version: "5.3.0" + version: "5.5.4" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 750dfe0..47ef824 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,6 +43,9 @@ dependencies: gsheets: ^0.5.0 shared_preferences: ^2.5.2 +dependency_overrides: + win32: ^5.5.4 + dev_dependencies: flutter_test: sdk: flutter From c87d62137d62ae51312ad6f47cb8a24cd9bbe188 Mon Sep 17 00:00:00 2001 From: ryanidk <46634687+ryanidk@users.noreply.github.com> Date: Sun, 16 Mar 2025 20:12:25 -0400 Subject: [PATCH 3/4] try update --- pubspec.lock | 88 ++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index f053a20..af92844 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,18 +5,18 @@ packages: dependency: transitive description: name: _discoveryapis_commons - sha256: f8bb1fdbd77f3d5c1d62b5b0eca75fbf1e41bf4f6c62628f880582e2182ae45d + sha256: "113c4100b90a5b70a983541782431b82168b3cae166ab130649c36eb3559d498" url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.7" args: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.7.0" async: dependency: transitive description: @@ -61,10 +61,10 @@ packages: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.6" cupertino_icons: dependency: "direct main" description: @@ -85,18 +85,18 @@ packages: dependency: transitive description: name: ffi - sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" file: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "7.0.1" flutter: dependency: "direct main" description: flutter @@ -114,10 +114,10 @@ packages: dependency: "direct main" description: name: flutter_svg - sha256: "7b4ca6cf3304575fe9c8ec64813c8d02ee41d2afe60bcfe0678bcb5375d596a2" + sha256: c200fd79c918a40c5cd50ea0877fa13f81bdaf6f0a5d3dbcc2a13e3285d6aa1b url: "https://pub.dev" source: hosted - version: "2.0.10+1" + version: "2.0.17" flutter_test: dependency: "direct dev" description: flutter @@ -148,10 +148,10 @@ packages: dependency: transitive description: name: googleapis_auth - sha256: cafc46446574fd42826aa4cd4d623c94482598fda0a5a5649bf2781bcbc09258 + sha256: befd71383a955535060acde8792e7efc11d2fccd03dd1d3ec434e85b68775938 url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "1.6.0" gsheets: dependency: "direct main" description: @@ -172,10 +172,10 @@ packages: dependency: transitive description: name: http_parser - sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.1.2" leak_tracker: dependency: transitive description: @@ -244,10 +244,10 @@ packages: dependency: transitive description: name: path_parsing - sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" path_provider_linux: dependency: transitive description: @@ -268,10 +268,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.0" petitparser: dependency: transitive description: @@ -284,10 +284,10 @@ packages: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.6" plugin_platform_interface: dependency: transitive description: @@ -300,10 +300,10 @@ packages: dependency: transitive description: name: qr - sha256: "64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3" + sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" qr_code_scanner_plus: dependency: "direct main" description: @@ -433,10 +433,10 @@ packages: dependency: transitive description: name: typed_data - sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.4.0" url_launcher: dependency: "direct main" description: @@ -449,10 +449,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 + sha256: "1d0eae19bd7606ef60fe69ef3b312a437a16549476c42321d5dc1506c9ca3bf4" url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.3.15" url_launcher_ios: dependency: "direct main" description: @@ -465,18 +465,18 @@ packages: dependency: transitive description: name: url_launcher_linux - sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.2.1" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.2" url_launcher_platform_interface: dependency: transitive description: @@ -497,34 +497,34 @@ packages: dependency: transitive description: name: url_launcher_windows - sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.4" vector_graphics: dependency: transitive description: name: vector_graphics - sha256: "32c3c684e02f9bc0afb0ae0aa653337a2fe022e8ab064bcd7ffda27a74e288e3" + sha256: "44cc7104ff32563122a929e4620cf3efd584194eec6d1d913eb5ba593dbcf6de" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.18" vector_graphics_codec: dependency: transitive description: name: vector_graphics_codec - sha256: c86987475f162fadff579e7320c7ddda04cd2fdeffbe1129227a85d9ac9e03da + sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.13" vector_graphics_compiler: dependency: transitive description: name: vector_graphics_compiler - sha256: "12faff3f73b1741a36ca7e31b292ddeb629af819ca9efe9953b70bd63fc8cd81" + sha256: "1b4b9e706a10294258727674a340ae0d6e64a7231980f9f9a3d12e4b42407aad" url: "https://pub.dev" source: hosted - version: "1.1.11+1" + version: "1.1.16" vector_math: dependency: transitive description: @@ -553,18 +553,18 @@ packages: dependency: "direct overridden" description: name: win32 - sha256: "68d1e89a91ed61ad9c370f9f8b6effed9ae5e0ede22a270bdfa6daf79fc2290a" + sha256: dc6ecaa00a7c708e5b4d10ee7bec8c270e9276dfcab1783f57e9962d7884305f url: "https://pub.dev" source: hosted - version: "5.5.4" + version: "5.12.0" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.1.0" xml: dependency: transitive description: From e794138ec83bea6149efe7cfb1ca4ca7c0b907fb Mon Sep 17 00:00:00 2001 From: ryanidk <46634687+ryanidk@users.noreply.github.com> Date: Sun, 16 Mar 2025 20:17:53 -0400 Subject: [PATCH 4/4] update pit scouting form to handle additional item and improve error handling --- lib/screens/pit_scouting.dart | 165 ++++++++++++++++++---------------- 1 file changed, 86 insertions(+), 79 deletions(-) diff --git a/lib/screens/pit_scouting.dart b/lib/screens/pit_scouting.dart index 85a8293..2142c01 100644 --- a/lib/screens/pit_scouting.dart +++ b/lib/screens/pit_scouting.dart @@ -129,89 +129,96 @@ class _PitScoutingState extends State { ), body: ListView.builder( padding: const EdgeInsets.all(8), - itemCount: formFields['Pit']?.length ?? 0, + itemCount: formFields['Pit']?.length + 1 ?? 0, itemBuilder: (BuildContext context, int index) { - var field = formFields['Pit'][index]; - bool showError = fieldErrors[field['name']] ?? false; - if (field['type'] == 'number') { - return Column( - children: [ - TextFormField( - keyboardType: TextInputType.number, - initialValue: - textValues[field['name']] ?? '', // Use the stored value - decoration: InputDecoration( - labelText: field['name'], - errorText: showError ? 'This field is required' : null, - ), - onChanged: (value) { - if (field['required'] && (value == null || value.isEmpty)) { - fieldErrors[field['name']] = true; - } else { - fieldErrors[field['name']] = false; - } - textValues[field['name']] = value; // Update textValues - setState(() {}); - }, - ), - ], - ); - } else if (field['type'] == 'text') { - return Column( - children: [ - TextFormField( - initialValue: - textValues[field['name']] ?? '', // Use the stored value - decoration: InputDecoration( - labelText: field['name'], - errorText: showError ? 'This field is required' : null, + if (index != formFields['Pit']?.length) { + var field = formFields['Pit'][index]; + bool showError = fieldErrors[field['name']] ?? false; + if (field['type'] == 'number') { + return Column( + children: [ + TextFormField( + keyboardType: TextInputType.number, + initialValue: + textValues[field['name']] ?? '', // Use the stored value + decoration: InputDecoration( + labelText: field['name'], + errorText: showError ? 'This field is required' : null, + ), + onChanged: (value) { + if (field['required'] && + (value == null || value.isEmpty)) { + fieldErrors[field['name']] = true; + } else { + fieldErrors[field['name']] = false; + } + textValues[field['name']] = value; // Update textValues + setState(() {}); + }, ), - onChanged: (value) { - if (field['required'] && (value == null || value.isEmpty)) { - fieldErrors[field['name']] = true; - } else { - fieldErrors[field['name']] = false; - } - textValues[field['name']] = value; // Update textValues - setState(() {}); - }, - ), - ], - ); - } else if (field['type'] == 'radio') { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - field['name'], - style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - ), - ...field['choices'].map((choice) { - return ListTile( - title: Text(choice), - leading: Radio( - value: choice, - groupValue: radioValues[field['name']], - onChanged: (String? value) { - if (value != null) { - setState(() { - radioValues[field['name']] = value; - fieldErrors[field['name']] = false; - }); - } - }, + ], + ); + } else if (field['type'] == 'text') { + return Column( + children: [ + TextFormField( + initialValue: + textValues[field['name']] ?? '', // Use the stored value + decoration: InputDecoration( + labelText: field['name'], + errorText: showError ? 'This field is required' : null, ), - ); - }).toList(), - showError - ? Text('This field is required', - style: TextStyle(color: Colors.red)) - : SizedBox.shrink(), - ], - ); + onChanged: (value) { + if (field['required'] && + (value == null || value.isEmpty)) { + fieldErrors[field['name']] = true; + } else { + fieldErrors[field['name']] = false; + } + textValues[field['name']] = value; // Update textValues + setState(() {}); + }, + ), + ], + ); + } else if (field['type'] == 'radio') { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + field['name'], + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + ...field['choices'].map((choice) { + return ListTile( + title: Text(choice), + leading: Radio( + value: choice, + groupValue: radioValues[field['name']], + onChanged: (String? value) { + if (value != null) { + setState(() { + radioValues[field['name']] = value; + fieldErrors[field['name']] = false; + }); + } + }, + ), + ); + }).toList(), + showError + ? Text('This field is required', + style: TextStyle(color: Colors.red)) + : SizedBox.shrink(), + ], + ); + } else { + return SizedBox + .shrink(); // Return an empty widget for unsupported field types + } } else { - return SizedBox - .shrink(); // Return an empty widget for unsupported field types + return Text( + "Please send pictures of the robot to the scouting channel"); } }, ),