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

套件詳情v0.0.4

flutter_custom_cursor

直接從記憶體緩衝區建立/設定自訂滑鼠游標。

macOSWindowsLinux
近 30 天下載
5.4萬
喜歡數
19
Pub 分數
140

安裝套件

flutter pub add flutter_custom_cursor

套件介紹

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

一個 Flutter 套件,讓開發者能在桌面平台使用記憶體緩衝區設定自訂滑鼠游標。它能透過直接從記憶體載入游標資料,精確控制游標外觀,非常適合需要獨特或動態游標設計的應用程式。此套件專為 Windows、Linux 和 macOS 設計,可與 Flutter 的桌面目標無縫整合。支援進階游標自訂,不依賴外部檔案,提升 UI 設計的效能與彈性。

適用情境

  • 遊戲中的自定義游標
  • 互動式 UI 元素
  • 桌面應用程式品牌化
  • 動態游標變更
  • 高效能游標渲染
  • 可存取性功能

主要特色

  • 直接記憶體緩衝區輸入
  • 跨平台桌面支援
  • 無外部檔案依賴
  • 高效能
  • 與 Flutter 的輕鬆整合
  • 支援動畫游標

適合對象

  • 桌面應用程式開發者
  • 遊戲開發者
  • UI/UX 設計師
  • 需要獨特游標行為的應用程式
  • 對效能敏感的專案

使用建議

  • 僅限桌面平台
  • 需要平台特定的實作知識
  • 游標緩衝區的記憶體管理
  • 不適合用於行動應用程式
  • 游標大小與格式約束
  • 與某些作業系統版本可能存在相容性問題

原始 README

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

flutter_custom_cursor

This plugin allows to create/set a custom mouse cursor directly from a memory buffer.

Big thanks to imiskolee to create the base of this plugin.

Platforms

  • [x] macOS
  • [x] Windows
  • [x] Linux

Note: Currently, the api required by this plugin on Windows is included in flutter master branch. It means that u need to use this plugin with flutter master branch on Windows platform. See flutter engine PR#36143 for details.

Update: the latest Flutter 3.7.0 does not contain PR above, which merges to flutter-3.7.0-candidate.2, while Flutter stable 3.7.0 is using flutter-3.7.0-candidate.1. This limitation will be lifted maybe in the next Flutter stable release.

Get prepared

Register your custom cursor before

// register this cursor
cursorName = await CursorManager.instance.registerCursor(CursorData()
  ..name = "test"
  ..buffer =
      Platform.isWindows ? memoryCursorDataRawBGRA : memoryCursorDataRawPNG
  ..height = img.height
  ..width = img.width
  ..hotX = 0
  ..hotY = 0);

Note that a String cacheName will be returned by the function registerCursor, which can be used to set this cursor to system or delete this cursor.

CursorData.buffer is a Uint8List which contains the cursor data. Be aware that on Windows, buffer is formatted by rawBGRA, other OS(s) are rawPNG.

see the example project for details.

Set the custom cursor

We have implemented the FlutterCustomMemoryImageCursor class, which is a subclass of MouseCursor. This class will automatically set the memory cursor for you. Keep it simple.

MouseRegion(
  cursor: FlutterCustomMemoryImageCursor(key: cursorName),
  child: Row(
    children: [
      Text("Memory image here", style: style),
    ],
  ),
),

Delete the cursor

You can delete a cursor with the cursorName.

await CursorManager.instance.deleteCursor("cursorName");

所屬分類

原始碼儲存庫

使用此套件的專案