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

swipeable_card_stack 封面
套件詳情v0.0.5

swipeable_card_stack

這是一個類似 Tinder 的可滑動卡片套件。您可以將自己的小部件加入堆疊中,接收所有四個方向的事件:左、右、上和下。您可以為每個方向定義自己的業務邏輯。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
216
喜歡數
106
Pub 分數
115

安裝套件

flutter pub add swipeable_card_stack

套件介紹

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

一個 Flutter 套件,可實現類似 Tinder 的可滑動卡片堆疊功能,讓開發者能使用自己的元件來自訂卡片。它支援四個滑動方向——左、右、上和下,並為每個方向提供事件回調,以實現各方向的自訂業務邏輯。非常適合需要互動式卡片導航的應用程式,例如約會應用或內容發現介面。此套件具備跨平台特性,可在 Android、iOS、Web、macOS、Windows 和 Linux 上運作。

適用情境

  • 約會應用介面
  • 內容發現功能
  • 互動產品展示
  • 使用者偏好收集
  • 遊戲化使用者互動
  • 基於滑動的導航

主要特色

  • 可自定義的卡片小部件
  • 四向滑動事件
  • 每滑動一次可擴展的業務邏輯
  • 跨平台支援
  • 流暢的動畫過渡
  • 透過 pub.dev 實現輕鬆整合

適合對象

  • 開發類似 Tinder 的應用的開發者
  • 需要互動式卡片UI的設計師
  • 需要手勢驅動使用者流程的專案
  • 帶有滑動互動的行動和網路應用
  • 原型設計互動式卡片體驗

使用建議

  • 需要處理滑動邏輯的狀態管理
  • 可能需要額外的樣式來處理複雜的卡片設計
  • 大型卡堆的性能影響
  • 內建自訂功能有限,僅限於滑動方向
  • 依賴外部動畫庫以實現高級效果

原始 README

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

swipeable_card_stack

This is Tinder like swipeable cards package. You can add your own widgets to the stack, receive all four events, left, right, up and down. You can define your own business logic for each direction.

Demo

Documentation

Installation

Add swipeable_card_stack to your pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter

  # added below
  swipeable_card_stack: <latest version>
Adding to app

Use the SwipeableCardsSection widget provided by the package

@override
  Widget build(BuildContext context) {
    //create a SwipeableCardSectionController
    SwipeableCardSectionController _cardController = SwipeableCardSectionController();

    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          SwipeableCardsSection(
            cardController: _cardController,
            context: context,
            //add the first 3 cards (widgets)
            items: [
              CardView(text: "First card"),
              CardView(text: "Second card"),
              CardView(text: "Third card"),
            ],
            //Get card swipe event callbacks
            onCardSwiped: (dir, index, widget) {
              //Add the next card using _cardController
              _cardController.addItem(CardView(text: "Next card"));
              
              //Take action on the swiped widget based on the direction of swipe
              //Return false to not animate cards
            },
            //
            enableSwipeUp: true,
            enableSwipeDown: false,
          ),
          //other children
        )
    }
          
Author

CodeToArt Technology

所屬分類

原始碼儲存庫

使用此套件的專案