パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細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デザイナー
  • 独自のカーソル動作を必要とするアプリケーション
  • パフォーマンスに敏感なプロジェクト

注意事項

  • デスクトッププラットフォームに限定
  • プラットフォーム固有の実装に関する知識が必要です
  • カーソルバッファのメモリ管理
  • モバイルアプリには適していません
  • カーソルのサイズとフォーマット制約
  • 特定のOSバージョンとの互換性上の問題

元の 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");

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト