【问题标题】:Flare Flutter AnimationFlare Flutter 动画
【发布时间】:2020-01-03 16:23:09
【问题描述】:

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

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

【问题讨论】:

  • 不确定,但您可以使用计时器触发路线

标签: flutter flutter-layout flutter-animation flare flare3d


【解决方案1】:

这很简单,只需将回调属性添加到 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
                      },
                    ),
                  ),
                ],
              )
            ],
          )
        ],
      ),
    );

【讨论】:

    猜你喜欢
    • 2020-11-15
    • 2019-10-26
    • 2019-07-29
    • 2019-08-13
    • 1970-01-01
    • 2020-04-20
    • 2020-01-02
    • 2020-04-05
    相关资源
    最近更新 更多