搜索插件、代码仓与 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

所属分类

源码仓库

使用此插件的项目

暂无相关数据。