nlfiedler / choose_input_chips

Flutter input field that uses InputChips as values.
BSD 2-Clause "Simplified" License
1 stars 11 forks source link

Maybe use `EditableText` instead of `RawKeyboardListener` and other widgets. #9

Open nlfiedler opened 1 year ago

nlfiedler commented 1 year ago

Using TextInputClient, TextEditingValue, and TextInputConnection is very fragile. Add in the need to implement a RawKeyboardListener to handle backspace and you have a Rube Goldberg machine. There is conditional logic in place that is necessary because of the differences between the browser and native platforms. That should not be the case, it's a code smell. Getting everything to work on all platforms is extremely difficult.

Ideally would use an EditableText to replace the TextInputClient, TextEditingValue, TextInputConnection, and RawKeyboardListener. The editable text widget would replace the Text and TextCursor as well. May need to consider how a fully editable text field will change the search functionality. As it stands now, the user cannot edit the entered text, nor select the text. They can only type one character at a time and backspace.

sarbogast commented 1 year ago

And I don't know if it's related but I can't seem to be able to type a space character in the text field on the web. It works fine in iOS, but not on the web. And given I wanted to use this field to be able to insert custom values on the fly in addition to selecting existing ones, this won't work.

nlfiedler commented 1 year ago

I recently noticed that same space character issue with the other tags library I forked (https://github.com/nlfiedler/multi_tag_picker), which is completely different from this library, so it's a mystery why both would have an identical problem.

amrgetment commented 5 months ago

I want this change so I can have selection and past functionality

nlfiedler commented 5 months ago

Yes, copy/paste and just basic text input functionality would be great. I'm open to pull requests. One of these days I will make an effort to fix this as the "can't type a space" problem is an annoyance for me as well.

amrgetment commented 4 months ago

I used this library as a base https://github.com/zsoerenm/chips_input and I fixed several issues there here in the example folder my input chip with text field https://github.com/amorenew/amr_chip_input Features:

  1. Copy/Past/Suggestion
  2. On comma, add new chip
  3. On Submit add a new chip
  4. non-duplicates chips
  5. Counter text for max text field length
  6. Backspace works normally @nlfiedler My code has extra stuff related to ensuring visibility for a bottom sheet you can remove and take what you want
nlfiedler commented 4 months ago

Thank you for that, I will definitely take a look when I get back home from traveling.