Fintasys / emoji_picker_flutter

A Flutter package that provides an Emoji picker widget with 1500+ emojis in 8 categories.
MIT License
155 stars 114 forks source link

added improved logic for adding and deleting emijos to the library #88

Closed LostInDarkMath closed 1 year ago

LostInDarkMath commented 1 year ago

Hi there!

I found an ugly bug in your example code: Adding and removing emojis with the build-in backspace button only works if the cursor is at the and if the input text. It is not possible to add an emoji between to words and also remove an emoji (or even normal characters) inside a text. While I updated the example it turns out to be quite complex with many edge cases. So I wonder why the library does not handle this complex stuff itself to make it very easy to use. That's what I done inside this PR: I added a paramater TextEditingController to the EmojiPicker where you can (optionally) pass some TextEditingController which is linked to some sort of TextField (I bet this is the use-case in 99 %). And then you are done! The EmojiPicker widget handles all the complex logic for you. Check out the example to get an idea how simple it now is.

And yes, it contains no breaking changes (even if it sounds like^^).

Hope you like it :)

And by the way I bumped the dependency constraints to Flutter 3 which fixes https://github.com/Fintasys/emoji_picker_flutter/issues/84.

LostInDarkMath commented 1 year ago

Thank you for your fast reply! A made all requested changes :)