SingleTickerProviderStateMixin animation is blinking instead of smooth slide of png images

14 views Asked by At

I tried to animate couple of images one-by-one to create animation for splash screen. I tried to use build in tools but it looks like I am doing something wrong. Maybe I should go for third party library, do you recommend anything good to solve this issue?

My problem is that animation is working but it blinks when new frame is generated. So 37 images == 37 blinks. How to fix that, or should I go for any lib? I wanted to do this by myself so as not to rely on an external library. Thanks for help

 late AnimationController _controller;
  late Animation<int> _animation;

  @override
  void initState() {
    super.initState();

    _controller = AnimationController(vsync: this, duration: const Duration(seconds: 6));
    _animation = IntTween(begin: 0, end: 30).animate(_controller);
    _controller.forward();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Center(
            child: AnimatedBuilder(
                animation: _animation,
                builder: (context, child) {
                  return Image.asset('assets/animation_${_animation.value}.png');
                })));
  }

I expect to achieve a smooth gif-like animation and I want to know when it ends to switch view.

0

There are 0 answers