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

套件詳情v2.0.1

flippable_box

一個雙面容器,翻轉後可顯示兩側內容。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
66
喜歡數
29
Pub 分數
150

安裝套件

flutter pub add flippable_box

套件介紹

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

flippable_box 是一個 Flutter 套件,提供一個雙面 Container,能夠在兩個不同內容面之間翻轉。它支援正面與背面之間的流暢動畫過渡,非常適合用於互動式 UI 元素,例如卡片或翻轉效果。此套件支援所有主要平台,包含 Android、iOS、Web、macOS、Windows 與 Linux,讓跨平台應用更具彈性。基於 Flutter 的動畫系統建構,提供反應式且可自訂的翻轉行為。

適用情境

  • 互動式卡片介面
  • 產品詳情翻轉卡片
  • 測驗或閃卡應用
  • 動畫導航元素
  • 遊戲UI組件

主要特色

  • 平滑的3D翻轉動畫
  • 可自訂的正面與背面內容
  • 跨平台相容性
  • 與現有組件的輕鬆整合
  • 支援點擊和手勢觸發

適合對象

  • 開發互動式 UI 的開發者
  • 教育類應用開發者
  • 遊戲化應用設計師
  • 尋求動態過渡的設計師

使用建議

  • 可能影響低階裝置的效能
  • 對於複雜內容,需要仔細進行版面管理
  • 僅限基於容器的翻轉
  • 不適用於非互動式靜態顯示

原始 README

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

flippable_box

FlippableBox is a double-sided Container, that holds two pieces of content and automatically re-sizes to match its content, whenever its flipped over.

Usage

First import the package into your class:

import 'package:flippable_box/flippable_box.dart';

Create a FlippableBox with two child Containers. Change the isFlipped property to trigger the internal flip animation.

GestureDetector(
    onTap: () => setState(() => _isFlipped = !_isFlipped),
    child: FlippableBox(
        front: Container(width: 200, height: 200, color: Colors.white),
        back: Container(width: 300, height: 300, color: Colors.white),
        isFlipped: _isFlipped,
    ),
)

NOTE: It is required that the children are Containers, and have their size or constraints set manually, as shown in the example above. This is so the Box knows what its target size is when animating.

To control the flip animation, you can set duration, curve and flipVt which will cause the flip to be in the vertical axis rather than horizontal.

You can also specify a bg which takes a BoxDecoration, and a borderRadius in case you'd like to clip the child contents.

FlippableBox(
    front: child1,
    back: child2,
    isFlipped: _isFlipped,
    borderRadius: 32, //Uses a ClipRRect to clip contents of child containers
    bg: BoxDecoration(color: Colors.white), //Paints the box itself with a shared background
    duration: 0.5, //half second duration
    flipVt: true, //Flip vertically instead of horizontal
    curve: Curves.easeOut,
)

Example

See the example directory for a simple example.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。