Home > Net >  Animation only works when the window is resized
Animation only works when the window is resized

Time:10-31

The problem is that the animation only works if you start resizing the window. Tried on windows, web, android. Used by StatefulWidget and SlideTransition. The class is complex enough to post this code here.

Has anyone experienced this/similar issue?

CodePudding user response:

The first problem is when we pass new coordinates(x, y) data to CustomPaint we may need override method shouldRepaint in CustomPainter with value true:

@override
bool shouldRepaint(CustomPainter oldDelegate) {
    return true;
  }

The second problem is when we pass mutable data in widget and such widget is many. The data should be immutable.

  • Related