artur-ios-dev / flutter_control_pad

A control pad with a virtual joystick and buttons.
https://pub.dev/packages/control_pad
GNU General Public License v3.0
40 stars 24 forks source link

Calling setState() in the onDirectionChanged property will make the joystick not working... #26

Open phandrieu opened 4 years ago

phandrieu commented 4 years ago

Hey, Is there a way to call setState in the onDirecitonChanged callback or is there another way to do it ? Thanks :)

metanav commented 4 years ago

I am facing same issue.

luistrivelatto commented 3 years ago

+1. It seems any call to setState that triggers constructing a new JoystickView widget makes it return to the (0, 0) position. E.g., I set a timer that calls setState every 100 milliseconds. Then it works for those 100 milliseconds, then when the setState call is triggered and the parent widget is rebuilt, the JoystickView gets back to (0, 0).