Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

State of the cards synchronization problem in the bloc and widget #11

Open
konstantin-doncov opened this issue Feb 8, 2020 · 0 comments

Comments

@konstantin-doncov
Copy link

Hello, I faced a problem when used your cards(Gesture detector and Alignment type) with bloc.

If you want more details I think it will be better for you to check my original code. Also, here is the original issue in the bloc repository

I need to keep card which is in the process of removing(when card goes beyond the screen), because animation requires this instance. So I keep it in the special var deletingCard in the state. When animation is finished it resets this var to null.
But here is a problem. When new cards are loaded in the bloc I add them in the state and copy previous deletingCard var in the new state which I will yield:

yield GameDeckLoadedState(state.isNeedToAnimate, state.deletingCard, result);

But there is a delay between sending and receiving the state, so during the sending the deletingCard variable is not equal to null(for example, it's not always so) and we copy it to the new state, and when receiving the state the animation is already completed and the variable of old state is reset to null in the widget, but in the new state it is not so and the variable is not null.

As I understand, the animation is constantly rebuilding the widget while it removes the card.
So the situation is also possible when the last update of the widget occurs during the removal of the card, and during this comes a new state with a variable not equal to zero. The animation ended and the variable was reset, but a new state with a non-null variable returned this card back to the deck.

That is why the delay, which I specifically added, added and removed the problem with the different values.

Regards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant