JRowan
JRowan

Reputation: 7114

trying to get animation to play above background image

this is my first flutter question and I am trying to get an animation to play above the background image in a stack. if I remove the image then I can see the animation playing but with the image in there no animation plays and I can see it for a split second before the image is put in there so im guessing the animation is behind the image.

return  Stack(
      alignment: Alignment.center,

      children: <Widget>[

        Positioned.fill(child: new Image.asset(
            colors[_Element.image],
            width: size.width,
            height: size.height,
            fit: BoxFit.fill),),
        Positioned.fill(child: Container(
          child: AnimatedBuilder(
            animation: CurvedAnimation(parent: _controller, curve: Curves.fastOutSlowIn),
            builder: (context, child){
              return Stack(
                alignment: Alignment.center,
                children: <Widget>[

                  _buildContainer(150 * _controller.value),
                  _buildContainer(200 * _controller.value),
                  _buildContainer(250 * _controller.value),
                  _buildContainer(300 * _controller.value),
                  _buildContainer(350 * _controller.value),
                ],
              );
            },
          ),
        ),),

Widget _buildContainer(double radius) {
    return Container(
      width: radius,
      height: radius,
      decoration: BoxDecoration(
        shape: BoxShape.circle,
        color: Colors.blue.withOpacity(1 - _controller.value),
      ),
    );

  }

thank you for your time

Upvotes: 0

Views: 206

Answers (1)

Michal Olechowski
Michal Olechowski

Reputation: 646

Hey there is a bug reported with you problem you can follow it here #44845 for temporary workaround you can wrap the Image widget in a RepaintBoundary.

Upvotes: 1

Related Questions