V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
weichengwu
V2EX  ›  Flutter

请教一个 Flutter 转场动画问题

  •  
  •   weichengwu · 2021-04-22 16:07:58 +08:00 · 1239 次点击
    这是一个创建于 1093 天前的主题,其中的信息可能已经有所发展或是发生改变。

    下面这段代码:

    Widget buildWidget() {
      if (showBig) {
        return BigWidget();
      } else {
        return SmallWidget();
      }
    }
    

    我希望在 BigWidgetSmallWidget 切换的时候加上转场动画,请问如何实现?

    3 条回复    2021-04-22 18:25:18 +08:00
    en20
        1
    en20  
       2021-04-22 17:42:39 +08:00
    ```
    onPressed: () async {
    final result =
    await Navigator.push(context, MaterialPageRoute(builder: (context) => Setting()));
    print('setting result: $result');
    },
    ```
    en20
        2
    en20  
       2021-04-22 17:43:57 +08:00
    原来不是路由啊,这里看一下 https://flutter.cn/docs/development/ui/animations
    debuggerx
        3
    debuggerx  
       2021-04-22 18:25:18 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1748 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 16:36 · PVG 00:36 · LAX 09:36 · JFK 12:36
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.