kauemurakami / getx_pattern

Design pattern designed to standardize your projects with GetX on Flutter.
https://kauemurakami.github.io/getx_pattern
1k stars 235 forks source link

how to use Animation using the getx package and this pattern? #7

Closed rustiever closed 4 years ago

rustiever commented 4 years ago

hai @kauemurakami !. can you give one simple example for animation using getx, Can we do animation with getx or should i go with statefullWidget. coz im confused how to use the package and this pattern to implement animations.

kauemurakami commented 4 years ago

Hello rustivier, well When I have animation pages like a splash screen with an object moving with Animation, use in a StatefullWidget, as a matter of fact, Getx has some statefull widgets like GetX, Obx, I believe that some animations can happen in them, the only difference is that it only "recognizes" the change, when there is some change in the state of the variable being observed. For example, a container rotate when clicked can be assigned to an observable variable in our controller, and only when we change it from false to true will the widget re-render the necessary. Since the StatefullWidget with animations, it has life cycles that some animations need, such as onClose, onInit, where you will need to declare AnimationsController etc. So far I have always used statefullWidgets for pure animations, and for libs, like credit cards with spin effects, I normally use a GetX or Obx, because the animation is being controlled from the change or not of my variable.obs .

rustiever commented 4 years ago

Ok! @kauemurakami thanks bro, It helped to make the decision