搜尋套件、儲存庫與 APP 分類

page_flip_builder 封面
套件詳情v0.1.4

page_flip_builder

一個自訂的 Flutter 小部件,可讓您在應用程式中實現互動式翻頁過渡效果。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
360
喜歡數
122
Pub 分數
145

安裝套件

flutter pub add page_flip_builder

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個提供互動式翻頁動畫的 Flutter 小部件,非常適合用來創造沉浸式的閱讀或展示體驗。它能實現順暢、真實的頁面翻轉過渡效果,增強數位書籍、作品集或互動教學應用中的使用者參與感。此元件著重於效能與自訂功能,支援觸控手勢,並可整合至各種版面中。該套件輕量且跨所有主要平台相容。

適用情境

  • 電子書閱讀器
  • 互動式簡報
  • 投資組合展示
  • 教育類應用
  • 遊戲使用者介面

主要特色

  • 真實的翻頁動畫
  • 基於手勢的互動
  • 跨平台支援
  • 可自定義的過渡效果
  • 輕量且高效
  • 與現有組件的輕鬆整合

適合對象

  • 尋求引人入勝的使用者介面的應用程式開發者
  • 電子書或數位雜誌的創作者
  • 專注於互動敘事的設計師
  • 開發教育或教學應用的開發者
  • 針對多個平台的團隊

使用建議

  • 可能需要針對複雜佈局進行優化
  • 性能取決於設備功能
  • 僅限2D翻轉效果(無3D深度)
  • 不適合高頻率動畫迴圈
  • 最佳搭配簡潔、聚焦的內容使用

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Page Flip Builder

Pub Language License Twitter

A custom Flutter widget that enables interactive page-flip transitions in your app.

You can use this to flip images, cards, or widgets of any size.

Preview

Page Flip screenshots

Card Flip screenshots

Also see the Flutter Web Live Preview.

Usage

Note: This package uses null-safety.

PageFlipBuilder is best used for full-screen page-flip transitions, but works with widgets of any size as long as their width and height is not unbounded.

PageFlipBuilder uses a drag gesture to interactively transition between a "front" and a "back" widget. These are specified with the frontBuilder and backBuilder arguments:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Container(
        // add a black background to prevent flickering on Android when the page flips
        color: Colors.black,
        child: PageFlipBuilder(
          frontBuilder: (_) => LightHomePage(),
          backBuilder: (_) => DarkHomePage(),
        ),
      ),
    );
  }
}

By defalt the flip happens along the vertical axis, but you can change the flipAxis to Axis.horizontal if you want.

For more control, you can also add a GlobalKey<PageFlipBuilderState> and programmatically flip the page with a callback-based API:

class MyApp extends StatelessWidget {
  // used to flip the page programmatically
  final pageFlipKey = GlobalKey<PageFlipBuilderState>();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Container(
        // add a black background to prevent flickering on Android when the page flips
        color: Colors.black,
        child: PageFlipBuilder(
          key: pageFlipKey,
          frontBuilder: (_) => LightHomePage(
            onFlip: () => pageFlipKey.currentState?.flip(),
          ),
          backBuilder: (_) => DarkHomePage(
            onFlip: () => pageFlipKey.currentState?.flip(),
          ),
          // flip the axis to horizontal
          flipAxis: Axis.horizontal,
          // customize tilt value
          maxTilt: 0.003,
          // customize scale
          maxScale: 0.2,
          // be notified when the flip has completed
          onFlipComplete: (isFrontSide) => print('isFrontSide: $isFrontSide'),
        ),
      ),
    );
  }
}

Features

  • Interactive flip transition using drag gestures (forward and reverse)
  • Fling animation to complete the transition on drag release
  • Flip page programmatically via callbacks
  • Flip around the horizontal or vertical axis
  • Flip widgets of any size
  • Customizable flip duration, tilt, scale

Testing the example app

Before running the example app, you need to create the ios, android, web folders as needed:

flutter create . --platform ios
flutter create . --platform android
flutter create . --platform web
LICENSE: MIT

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。