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

套件詳情v0.1.0

matrix_gesture_detector

一個將平移/旋轉/縮放手勢映射到 Matrix4 物件的觸控偵測器。

近 30 天下載
884
喜歡數
80
Pub 分數
25

安裝套件

flutter pub add matrix_gesture_detector

套件介紹

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

一個 Flutter 套件,可將使用者觸控手勢(例如拖曳、旋轉和縮放)轉換為 Matrix4 物件。它透過將多點觸控輸入對應至單一變換矩陣,實現精確的 2D 變換,非常適合互動式圖形、基於畫布的應用程式或需要進階手勢處理的自訂 UI 元件。此套件透過將底層觸控事件抽象為統一的矩陣表示,簡化複雜手勢的管理。

適用情境

  • 互動式畫布操作
  • 圖像或小部件縮放和旋轉
  • 自定繪圖工具
  • 基於手勢的使用者介面元件
  • 2D 變換動畫

主要特色

  • 將手勢映射到 Matrix4
  • 支援翻譯、旋轉和縮放
  • 支援多點觸控輸入
  • 為轉換邏輯提供乾淨的 API
  • 與 RenderBox 和 CustomPaint 集成

適合對象

  • 開發互動式圖形的開發者
  • 需要精確2D變換的應用
  • 具有捏合縮放或旋轉功能的 UI 組件
  • 基於畫布的繪圖應用
  • 高階手勢驅動介面

使用建議

  • 需要理解 Matrix4 和 2D 變換
  • 不適用於簡單的點擊或滑動手勢
  • 高頻率更新可能需要效能調校
  • 限制為2D變換
  • 無內建動畫支援

原始 README

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

matrix_gesture_detector

MatrixGestureDetector detects translation, scale and rotation gestures and combines them into Matrix4 object that can be used by Transform widget or by low level CustomPainter code. You can customize types of reported gestures by passing shouldTranslate, shouldScale and shouldRotate parameters.

Getting Started

The usage is as follows:

  MatrixGestureDetector(
    onMatrixUpdate: (Matrix4 m, Matrix4 tm, Matrix4 sm, Matrix4 rm) {
      setState(() {
        matrix = m;
      });
    },
    child: SomeWidgetThatUsesMatrix(
      matrix: matrix,
      ...
    )
  )

here: SomeWidgetThatUsesMatrix could be a Transform widget (transform_demo.dart) or a CustomPaint widget which CustomPainter uses Matrix4 in its low level drawing code (custom_painter_demo.dart).

Examples

bounded demo gif grid rotation demo gif blur demo gif

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案