【问题标题】:How to run .riv animation in splash screen using flutter如何使用颤振在启动画面中运行 .riv 动画
【发布时间】:2021-05-18 07:40:52
【问题描述】:

我无法在启动画面中运行 .riv 动画。请帮我这样做。我简单地运行它,它正在工作,但它在启动屏幕中不起作用。 帮我写代码。

【问题讨论】:

    标签: flutter dart animation splash-screen rive


    【解决方案1】:

    您可以使用 rive 库进行颤振:

    https://pub.dev/packages/rive_splash_screen

    【讨论】:

      【解决方案2】:

      您不能将 rive 添加到默认启动屏幕(您可以编辑它们,请查看 here)。但是您可以创建一个单独的颤动页面并将其用作您的第一页。像这样:

      void main() => runApp(MyApp());
      
      class MyApp extends StatefulWidget {
        @override
        _MyAppState createState() => _MyAppState();
      }
      
      class _MyAppState extends State<MyApp> {
        @override
        Widget build(BuildContext context) {
          return const MaterialApp(
            home: SplashPage(), // your rive animation goes here
          );
        }
      }
      

      【讨论】:

        猜你喜欢
        • 2018-09-15
        • 2019-01-15
        • 2021-02-24
        • 1970-01-01
        • 2019-09-01
        • 1970-01-01
        • 2020-08-30
        • 1970-01-01
        相关资源
        最近更新 更多