FLUTTER ECOSYSTEM

Kingtous/flutter_custom_cursor

메모리 버퍼에서 쉽게 사용자 정의 마우스 커서를 만들거나 설정하세요! 현재 Windows에서 Flutter 안정판을 사용 중이라면 https://github.com/Kingtous/engine와 함께 사용하세요.

flutter_custom_cursor 프로젝트 이미지
Stars
6
Forks
4
최근 푸시(UTC)
2026. 7. 4.
프로젝트 상태
활성
Tousking GitHub avatar
GITHUB User

Tousking ↗

Fighting for the top A! 2020&2022 @bytedance | RustDesk @rustdesk | @Tencent 2024 | Dora AI 2023-2024.

XThe Moon
언어C++CMakeDartSwiftCRuby

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개
  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^3.0.0

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

flutter_custom_cursor

https://img.shields.io/pub/v/flutter_custom_cursor?color=green https://img.shields.io/pub/publisher/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");