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

flicked_cards 封面
套件詳情v0.0.3

flicked_cards

一個由手勢驅動的可自訂且可擴展的卡片小部件

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
33
喜歡數
82
Pub 分數
145

安裝套件

flutter pub add flicked_cards

套件介紹

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

Flicked Cards 是一個手勢驅動、可自訂且可擴展的 Flutter 卡片小工具,支援互動式卡片翻轉與滑動動畫。採用平滑過渡與回應式手勢,讓開發者能建立吸引人的使用者介面,讓卡片可透過直覺的觸控操作翻轉或關閉。此套件支援 Android、iOS、Web、macOS、Windows 與 Linux 多個平台,非常適合需要動態卡片導航或內容呈現的跨平台應用。

適用情境

  • 互動式卡片滑塊
  • 滑動關閉介面
  • 基於手勢的內容探索
  • 儀表板中的卡片翻轉動畫
  • 帶有滑動卡片的使用者入門流程

主要特色

  • 由手勢驅動的卡片互動
  • 可自訂的翻轉和滑動動畫
  • 可擴充的設計,用於自訂行為
  • 跨平台相容性
  • 支援多種互動狀態
  • 可設定的過渡持續時間

適合對象

  • 開發互動式卡片 UI 的開發者
  • 需要滑動或翻頁手勢的應用
  • 尋求動畫卡片體驗的設計師
  • 跨平台移動與網頁應用
  • 原型設計互動式版面

使用建議

  • 可能需要對大型卡片列表進行效能調校
  • 自訂可能需要更深入的 Dart 知識
  • 與其他套件相比,內建主題較少
  • 由於動畫開銷,最適合中等數量的卡片

原始 README

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

flicked_cards

Build Status Codecov Pub Package MIT License

A gesture driven card swipping widget supporting custom animations.

Features

  • Awesome default animations provided out of the box
  • Progress through cards swipping both direction or in a single direction
  • Extensible through custom provided animations
  • Support piling or popping (depending on animation spec)

Examples

Here are some of the animation provided out of the box, take a look at the example to see all.

Cards used in these examples where taken from Brocodev

Example usage

FlickedCards(
  count: Superhero.marvelHeroes.length,
  animationStyle: FlipAnimation(),
  onSwiped: (idx, dir) => print('>>> $dir $idx'),
  builder: (index, progress, context) {
    final superHeroe = Superhero.marvelHeroes[index];
    return Container(
      child: Center(
        child: SuperheroCard(
            superhero: superHeroe,
            factorChange: 1 - progress),
      ),
    );
  },
)

Custom animations

flicked_cards provides an easy way to create custom animations but it is required to have a basic understanding of how cards can be layed out and how to position them depending on the drag progress and some of the properties in AnimationConfig.

Animations will be provided a progress value in the range (-1, 1) you should try to make you animation symmetric around 0 when posible. Like this:

You will have to reason about relative card indices:

Interface for animations

All animations will need to implement CardAnimation which basically defines:

  • animation of a particular card depending on swipe progress required
  • opacity of a particular card depending on swipe progress optional
  • where to apply transformations on cards (Fractional Offset)
typedef SwipeAnimation = Matrix4 Function(double progress);
typedef OpacityAnimation = double Function(double progress);

abstract class CardAnimation {
  AnimationConfig get config;
  LayoutConfig get layoutConfig;

  SwipeAnimation animationForCard({required int relativeIndex});

  OpacityAnimation opacityForCard({required int relativeIndex}) {
    return (_) => 1;
  }

  FractionalOffset fractionalOffsetForCard({required int relativeIndex});
}

Additionally to make this process a bit easier, 2 extra abstract classes that implement CardAnimation which are:

  • SymmetricCardAnimation
  • AsymmetricCardAnimation

Carousel animation is an example of a SymmetricCardAnimation take a look here

If struggling to make the animationlook at how the animations provided out of the box where implemented: here

Card layouts

Internally cards are placed in Stack widget so an animation can choose to work with a single or both of the following layouts:

Note that depending on the index some of cards will not be displayed:

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。