91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Flutter怎么實現添加頁面過渡動畫

發布時間:2022-05-17 09:14:06 來源:億速云 閱讀:290 作者:iii 欄目:開發技術

本篇內容介紹了“Flutter怎么實現添加頁面過渡動畫”的有關知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領大家學習一下如何處理這些情況吧!希望大家仔細閱讀,能夠學有所成!

    使用插件探索不同的轉換

    步驟 1: 在 pubspec.yaml 中添加頁面動畫轉換

    page_animation_transition

    Flutter怎么實現添加頁面過渡動畫

    步驟 2: 在 PageOne 上導入庫

    假設您正在從 PageOne 過渡到 PageTwo

    以下是圖書館支持的動畫類型:

    BottomToTopTransition   TopToBottomTransition  底到上轉換到底轉換

    RightToLeftTransition 右轉移

    LeftToRightTransition 左/右轉變

    FadeAnimationTransition 淡化動畫/轉換

    ScaleAnimationTransition 標量動畫/轉換

    RotationAnimationTransition 轉動/動畫/轉變

    TopToBottomFadedTransition 上到下到過渡

    BottomToTopFadedTransition 底部/上部/下部/上部/下部/上部/下部/上部/下部/上部/下部/上部/

    RightToLeftFadedTransition 右轉到/ftfaded/transition

    LeftToRightFadedTransition 左/右/插入/轉換

    步驟3.添加以下導航代碼行
    Navigator.of(context).push(PageAnimationTransition(page: const PageTwo(), pageAnimationType: BottomToTopTransition()));

    對于預定義的路由:

    onGenerateRoute: (settings) {
        switch (settings.name) {
          case '/pageTwo':
            return PageAnimationTransition(child: PageTwo(), pageAnimationType: LeftToRightFadedTransition());
            break;
          default:
            return null;
        }
      }

    Navigator.pushNamed(context, '/pageTwo');

    Pushnamed (context,’/pageTwo’) ;

    Output:

    輸出:

    Flutter怎么實現添加頁面過渡動畫

    其他類型轉換的完整代碼:

    import 'package:page_animation_transition/animations/bottom_to_top_faded_transition.dart';
    import 'package:page_animation_transition/animations/bottom_to_top_transition.dart';
    import 'package:page_animation_transition/animations/fade_animation_transition.dart';
    import 'package:page_animation_transition/animations/left_to_right_faded_transition.dart';
    import 'package:page_animation_transition/animations/left_to_right_transition.dart';
    import 'package:page_animation_transition/animations/right_to_left_faded_transition.dart';
    import 'package:page_animation_transition/animations/right_to_left_transition.dart';
    import 'package:page_animation_transition/animations/rotate_animation_transition.dart';
    import 'package:page_animation_transition/animations/scale_animation_transition.dart';
    import 'package:page_animation_transition/animations/top_to_bottom_faded.dart';
    import 'package:page_animation_transition/animations/top_to_bottom_transition.dart';
    import 'package:page_animation_transition/page_animation_transition.dart';
    import 'page_two.dart';
    import 'package:flutter/material.dart';class PageOne extends StatelessWidget {
      const PageOne({Key? key}) : super(key: key);[@override](http://twitter.com/override)
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: const Text('Page Animation Transition'),
            centerTitle: true,
          ),
          body: SizedBox(
            width: MediaQuery.of(context).size.width,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: BottomToTopTransition()));
                    },
                    child: const Text('Bottom To Top')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: TopToBottomTransition()));
                    },
                    child: const Text('Top to bottom')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: RightToLeftTransition()));
                    },
                    child: const Text('Right To Left')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: LeftToRightTransition()));
                    },
                    child: const Text('Left to Right')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: FadeAnimationTransition()));
                    },
                    child: const Text('Faded')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: ScaleAnimationTransition()));
                    },
                    child: const Text('Scale')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: RotationAnimationTransition()));
                    },
                    child: const Text('Rotate')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: TopToBottomFadedTransition()));
                    },
                    child: const Text('Top to Bottom Faded')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: BottomToTopFadedTransition()));
                    },
                    child: const Text('Bottom to Top Faded')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: RightToLeftFadedTransition()));
                    },
                    child: const Text('Right to Left Faded')),
                ElevatedButton(
                    onPressed: () {
                      Navigator.of(context).push(PageAnimationTransition(
                          page: const PageTwo(),
                          pageAnimationType: LeftToRightFadedTransition()));
                    },
                    child: const Text('Left to Right Faded')),
              ],
            ),
          ),
        );
      }
    }

    輸出:

    Flutter怎么實現添加頁面過渡動畫

    “Flutter怎么實現添加頁面過渡動畫”的內容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業相關的知識可以關注億速云網站,小編將為大家輸出更多高質量的實用文章!

    向AI問一下細節

    免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

    AI

    鄂温| 祁东县| 彭山县| 枣强县| 新疆| 蛟河市| 徐州市| 漳州市| 滨海县| 丹江口市| 凉城县| 佛冈县| 嘉义县| 松阳县| 游戏| 三门县| 周宁县| 中方县| 通海县| 柞水县| 琼中| 佛学| 奉新县| 邵武市| 达拉特旗| 科尔| 新兴县| 池州市| 怀仁县| 八宿县| 浦北县| 慈溪市| 永胜县| 郯城县| 视频| 昌乐县| 新河县| 新泰市| 三江| 孝昌县| 绵竹市|