搜索插件、代码仓与 APP 分类

插件详情v1.0.2

cube_transition

一个漂亮的3D立方体效果,用于您的 PageView 和 PageRoute 过渡。

近 30 天下载
47
喜欢数
70
Pub 分数
40

安装插件

flutter pub add cube_transition

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

CubeTransition 是一个 Flutter 包,为 PageView 和 PageRoute 过渡提供流畅的 3D 立方体动画效果。它通过在屏幕或页面之间的导航中增加深度和视觉吸引力来提升用户体验。该包利用 Flutter 的渲染功能,创建沉浸式的卡片式翻转动画,模拟真实立方体在 3D 空间中的旋转。适用于希望实现现代、引人入胜的过渡效果而又无需复杂实现的应用程序。可无缝集成到现有的 Flutter 导航模式中。

适合场景

  • PageView 页面过渡
  • PageRoute 导航效果
  • 交互式应用引导
  • 标签切换时的视觉反馈
  • 提升移动应用的用户界面质感

主要特点

  • 3D立方体旋转动画
  • 流畅且可自定义的过渡
  • 与 PageView 和 PageRoute 兼容
  • 轻量且易于集成
  • 支持方向翻转

适合对象

  • 寻求现代UI动画的开发者
  • 具有交互式导航的应用程序
  • 注重设计的 Flutter 项目
  • 强调用户参与度的移动应用

使用建议

  • 仅限3D立方体样式
  • 可能会影响低端设备的性能
  • 立方体大小或纹理无内置自定义选项
  • 需要手动处理过渡状态
  • 不适合非交互式或极简UI设计

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Cube Transition

pub package

A 3D Cube transition for your PageView and PageRoute.

Aeyrium Inc. is a provider of innovative software solutions for the business and commercial aviation

Features

  • Use the cube transition between the navigation of your pages.
  • Add cube transitions to your PageView.
  • Add custom transformation in your items of your PageView.

Getting started

You should ensure that you add the dependency in your flutter project.

dependencies:
  cube_transition: "^1.0.0"

You should then run flutter packages upgrade or update your packages in IntelliJ.

Import the package:

import 'package:cube_transition/cube_transition.dart';

Example Project

There is a example project in the example folder. Check it out. Otherwise, keep reading to get up and running.

Usage

Navigator Cube Transition

class Sample1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Navigator Cube Transition'),
      ),
      body: Center(
        child: RaisedButton(
          child: Text('Next Page'),
          onPressed: () {
            Navigator.of(context).push(
              CubePageRoute(
                enterPage: Sample1NextPage(),
                exitPage: this,
                duration: const Duration(milliseconds: 900),
              ),
            );
          },
        ),
      ),
    );
  }
}

PageView Cube Transition (default)

class Sample2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final height = MediaQuery.of(context).size.height / 2;
    return Scaffold(
      appBar: AppBar(
        title: Text('PageView Cube Transition'),
      ),
      body: Center(
        child: SizedBox(
          height: height,
          child: CubePageView(
            children: places
                .map(
                  (item) =>  Image.network(
                        item.url,
                        height: height,
                        fit: BoxFit.cover,
                      ),
                )
                .toList(),
          ),
        ),
      ),
    );
  }
}

PageView Cube Transition Custom (If you want more control over the items inside the CubePageView)

class Sample3 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final height = MediaQuery.of(context).size.height / 2;
    return Scaffold(
      appBar: AppBar(
        title: Text('Custom Cube Transition'),
      ),
      body: Center(
        child: SizedBox(
          height: height,
          child: CubePageView.builder(
            itemCount: places.length,
            itemBuilder: (context, index, notifier) {
              final item = places[index];
              final transform = Matrix4.identity();
              final t = (index - notifier).abs();
              final scale = lerpDouble(1.5, 0, t);
              transform.scale(scale, scale);
              return CubeWidget(
                index: index,
                pageNotifier: notifier,
                child: Stack(
                  children: [
                    Image.network(
                      item.url,
                      height: height,
                      fit: BoxFit.cover,
                    ),
                    Transform(
                      alignment: Alignment.center,
                      transform: transform,
                      child: Center(
                        child: Padding(
                          padding: const EdgeInsets.all(12.0),
                          child: Container(
                            decoration: BoxDecoration(boxShadow: [
                              BoxShadow(
                                color: Colors.black45,
                                spreadRadius: 5,
                                blurRadius: 5,
                              ),
                            ]),
                            child: Text(
                              item.name.split('-').join('\n'),
                              textAlign: TextAlign.center,
                              style: Theme.of(context).textTheme.title,
                            ),
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              );
            },
          ),
        ),
      ),
    );
  }
}

Copyright Aeyrium Inc

You can follow me on twitter @diegoveloper

所属分类

源码仓库

使用此插件的项目

暂无相关数据。