Dn-a / flutter_tags

With flutter tags you can create selectable or input tags that automatically adapt to the screen width
https://pub.dartlang.org/packages/flutter_tags
MIT License
507 stars 127 forks source link

Cancel onRemove #44

Closed ykaito21 closed 4 years ago

ykaito21 commented 4 years ago

I would like to ask user to remove tag or not before actually remove it with AlertDialog, but when I tried to do it, onRemove automatically remove item at that index and cause RangeError (index): Invalid value: Not in range 0..5, inclusive: 6.

Is there any temporary way to prevent this? If no, I wish to have it as feature request. Could be adding onTap callback to ItemTagsRemoveButton itself, then I can add my custom callback instead of using onRemove.

Dn-a commented 4 years ago

@ykaito21 I added a bool return value in the onRemoved method. ( true:delete, false: does nothing). check it and let me know

ykaito21 commented 4 years ago

Thanks for working on my request. I tried it, but actually I couldn't assign Future<bool> to use result of AlertDialog. I decided to use onLongPressed instead of onRemove, and it works fine. Anyway, I really appreciate your continuous hard work to improve this awesome package.