like_button
like_button copied to clipboard
Strange async behaviour
Hey guys great library but a question when i run the like count and isLiked from a stream and have the onTap trigger a change in the value on a remote server it breaks the animation any suggestion
ontap: Future
also i have the isLiked being set initially if liked or not from the stream
isLiked: mycontentModelStream.myContent.isLiked)
the values update but no animations
Reading closed issues i see #43 also had this issue in a stream builder
could you provide a simple runable demo? i can't see clearly with little code for this problem.
Will try to create something! Thanks
I had the same issue and this is how I solved it.
Don't set the "isLiked" value but instead use the "likeBuilder" to render the correct widget based on "like" or "unlike" state as determined by the stream you are using.
With this, whenever you "unlike" and "like" again, the animation will work.
"isLiked" is only set for "initial" rendering. So when the stream value changes, the whole "like_button" gets re-rendered vs just switching the "state" of like.
I had the same issue and this is how I solved it.
Don't set the "isLiked" value but instead use the "likeBuilder" to render the correct widget based on "like" or "unlike" state as determined by the stream you are using.
With this, whenever you "unlike" and "like" again, the animation will work.
"isLiked" is only set for "initial" rendering. So when the stream value changes, the whole "like_button" gets re-rendered vs just switching the "state" of like.
"isLiked" is only set for "initial" rendering ---- yes, you are right