简体   繁体   中英

Flare Flutter Animation

I'm trying to call an animation (which I got), but I want it after finalizing, forward to another page. How do I do the routing system or how can I get the animation to finish and call the other screen?

    return Scaffold(

      body: Stack(

        children: <Widget>[

          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Container(
                    width: 400,
                    height: 400,
                    alignment: Alignment.center,
                    child: FlareActor(
                      "assets/animations/LoadingM.flr",
                      alignment: Alignment.center,
                      fit: BoxFit.contain,
                      color: Colors.blue,
                      animation: _animationL,
                    ),
                  ),
                ],
              )
            ],
          )
        ],
      ),
    );
  }
}

This is really simple, you just add the callback property to your FlareActor.

return Scaffold(

      body: Stack(

        children: <Widget>[

          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Container(
                    width: 400,
                    height: 400,
                    alignment: Alignment.center,
                    child: FlareActor(
                      "assets/animations/LoadingM.flr",
                      alignment: Alignment.center,
                      fit: BoxFit.contain,
                      color: Colors.blue,
                      animation: _animationL,
                      callback: (String animationName) {
                        //Navigate to new page here
                        //hint: the animationName parameter tells you the name
                        //      of the animation that finished playing
                      },
                    ),
                  ),
                ],
              )
            ],
          )
        ],
      ),
    );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM