weichengwu
V2EX  ›  Flutter

请教一个 Flutter 转场动画问题

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

    下面这段代码:

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

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

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