weichengwu
V2EX  ›  Flutter

请教一个 Flutter 转场动画问题

  •  
  •   weichengwu · Apr 22, 2021 · 1990 views
    This topic created in 1916 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   ·   5640 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 61ms · UTC 01:38 · PVG 09:38 · LAX 18:38 · JFK 21:38
    ♥ Do have faith in what you're doing.