搜尋套件、儲存庫與 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

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。