0

我正在尝试调用动画(我得到了),但我希望在完成后将它转发到另一页。我该如何做路由系统或如何让动画完成并调用另一个屏幕?

    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,
                    ),
                  ),
                ],
              )
            ],
          )
        ],
      ),
    );
  }
}
4

1 回答 1

0

这非常简单,您只需将回调属性添加到您的 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
                      },
                    ),
                  ),
                ],
              )
            ],
          )
        ],
      ),
    );
于 2019-09-17T17:58:44.943 回答