【问题标题】:Custom splash screen with animation-Flutter带有动画的自定义闪屏-Flutter
【发布时间】:2022-01-04 23:11:40
【问题描述】:

我正在尝试显示带有动画的启动画面,我发现这篇文章:https://medium.com/@galadhruvil7/flutter-splash-screen-animation-16c50e18b9d8 我认为这很简单但很棒,我想将颤振图标更改为另一个图像和文本。这是代码

SplashScreenState() {
    _timer = new Timer(const Duration(seconds: 1), () {
      setState(() {
        assetImage = Row(
          children: [
            Image.asset('assets/logo.png', height: 500, width: 500),
            Text("trial")
          ],
        );
      });
    });
  }

并像这样显示小部件:

return Scaffold(
      backgroundColor: Colors.grey[850],
      body: Center(
        child: Container(
          child: assetImage,
        ),
      ),
    );

但是通过运行该代码,没有动画效果。有没有办法在将 Flutter 徽标更改为图像和文本时保持动画像我给出的源一样?

【问题讨论】:

    标签: flutter dart animation splash-screen fade


    【解决方案1】:

    通过带有条件运算符的AnimatedSwitcher,您可以使用图标和文本更改您的徽标。

    示例 - AnimatedSwitcherExample

    【讨论】:

      猜你喜欢
      • 2021-10-17
      • 1970-01-01
      • 2020-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-22
      • 2018-12-11
      相关资源
      最近更新 更多