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

套件詳情v0.0.1

swipe

在 Flutter 中檢測向上、向下、向左和向右滑動手勢的簡單方法。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
2370
喜歡數
46
Pub 分數
140

安裝套件

flutter pub add swipe

套件介紹

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

swipe 套件為 Flutter 應用程式提供了一種簡單直覺的方式來偵測方向性滑動手勢——上、下、左、右。它抽象了手勢辨識的複雜性,讓開發者能以最少的程式碼輕鬆地為組件新增滑動互動。非常適合建立互動式介面,例如滑桿、導航面板或遊戲控制,支援包括 Android、iOS、Web、macOS、Windows 和 Linux 在內的多個平台。此套件輕量且可無縫整合至現有的 Flutter 專案中。

適用情境

  • 實現滑動導航介面
  • 建立基於手勢的遊戲控制
  • 構建互動式滑塊或幻燈片
  • 透過滑動手勢新增快速動作
  • 設計響應式觸控佈局

主要特色

  • 用於檢測滑動方向的簡單 API
  • 支援所有主要平台
  • 最小化樣板程式碼
  • 內建手勢辨識
  • 與現有組件的輕鬆整合

適合對象

  • 開發觸控密集型應用的開發者
  • 尋求手勢互動的UI設計師
  • 跨平台行動與Web應用
  • 需要直覺式滑動導航的專案

使用建議

  • 可能需要調整以適應敏感的手勢檢測
  • 不適用於複雜的多點觸控手勢
  • 僅限基本滑動方向
  • 對高頻率手勢處理的效能影響
  • 依賴於 Flutter 手勢系統的穩定性

原始 README

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

Swipe

The easy way to detect swipe up, down, left and right in Flutter.

Getting Started

Add dependency to your flutter project:

$ flutter pub add swipe

or

dependencies:
  swipe: ^0.0.1

or

dependencies:
  swipe:
    git: 
      url: git://github.com/salkuadrat/swipe.git

Then run flutter pub get.

Usage

Here is a simple way of using Swipe.

Swipe(
  child: ..., // your child widget
  onSwipeUp: () {
    // do something when swiping up
  },
  onSwipeDown: () {
    // do something when swiping down
  },
  onSwipeLeft: () {
    // do something when swiping left
  },
  onSwipeRight: () {
    // do something when swiping right
  },
)

Customization

Swipe widget comes with additional parameters to customize your swiping experience.

Swipe(
  child: ...,
  onSwipeUp: ...,
  onSwipeDown: ...,
  onSwipeLeft: ...,
  onSwipeRight: ...,
  verticalMaxWidthThreshold: 50,
  verticalMinDisplacement: 100,
  verticalMinVelocity: 300,
  horizontalMaxHeightThreshold: 50,
  horizontalMinDisplacement: 100,
  horizontalMinVelocity: 300,
)

Example

You can try a working example here.

所屬分類

原始碼儲存庫

使用此套件的專案