weichengwu
V2EX  ›  Flutter

请教一个 Flutter 转场动画问题

  •  
  •   weichengwu · Apr 22, 2021 · 2001 views
    This topic created in 1923 days ago, the information mentioned may be changed or developed.

    下面这段代码:

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

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

    3 replies    2021-04-22 18:25:18 +08:00
    en20
        1
    en20  
       Apr 22, 2021
    ```
    onPressed: () async {
    final result =
    await Navigator.push(context, MaterialPageRoute(builder: (context) => Setting()));
    print('setting result: $result');
    },
    ```
    en20
        2
    en20  
       Apr 22, 2021
    原来不是路由啊,这里看一下 https://flutter.cn/docs/development/ui/animations
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1357 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 17:06 · PVG 01:06 · LAX 10:06 · JFK 13:06
    ♥ Do have faith in what you're doing.