From 97675f9f483cfed4763b48d3f07b51474e677f32 Mon Sep 17 00:00:00 2001 From: Doug Borg Date: Tue, 10 Feb 2026 19:14:52 -0700 Subject: [PATCH] Comment on commit c7cfdc471cfc91a3c365642791fdb63d00aedc33 by dougborg on 2026-02-11 02:14:40 UTC --- COMMENT | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 COMMENT diff --git a/COMMENT b/COMMENT new file mode 100644 index 0000000..4a57ce4 --- /dev/null +++ b/COMMENT @@ -0,0 +1,11 @@ +--- +An alternative approach to addressing this issue could be adjusting the `optionsBuilder` logic to avoid returning any suggestions when the input text field is empty, rather than guarding `onFieldSubmitted`. For instance: + +```dart +optionsBuilder: (TextEditingValue textEditingValue) { + if (textEditingValue.text.isEmpty) return []; + return suggestions.where((s) => s.contains(textEditingValue.text)); +} +``` + +This ensures that the `RawAutocomplete` widget doesn't offer any options to auto-select on submission when the field is cleared, potentially simplifying the implementation and avoiding the need for additional boolean flags (`guardOnSubmitted`). This pattern can be seen in some implementations "in the wild." \ No newline at end of file