isar / hive

Lightweight and blazing fast key-value database written in pure Dart.
Apache License 2.0
4.1k stars 407 forks source link

Animation, add, remove, modify items #123

Closed peekpt closed 4 years ago

peekpt commented 5 years ago

Question Is there a possibility to make a tutorial with WatchBoxBuilder + AnimatedList() with an HiveObject.

I tried but I wasn't successfully. It kind of works for the last object, but if you remove a middle object all index changes and object.delete() no longer works.

It will be cool to have a way to add remove items from box and magically animated on the UI.

simc commented 5 years ago

That is an interesting question. I never tried it myself but i'll check if it is possible. Please give me some time ;)

simc commented 4 years ago

I tried to implement an AnimatedList with Hive, but it is harder than I thought. The main problem is that BoxEvents don't contain the index of added or deleted entries. It would be too expensive to provide the index to each event.

Have you found a solution in the meantime?

peekpt commented 4 years ago

I can't verify right now, but if I can remember I could add on the first position only (0) and used dismissible widget to remove it.