/nes_ui_desktop_cursor

A flutter package that allows Nes UI Icon's to be used a mouse cursor on desktop.

Primary LanguageDartMIT LicenseMIT

Nes Ui Desktop Cursor

style: very good analysis Powered by Mason License: MIT

A flutter package that allows Nes UI Icon's to be used a mouse cursor on desktop

Installation 💻

❗ In order to start using Nes Ui Desktop Cursor you must have the Flutter SDK installed on your machine.

Install via flutter pub add:

dart pub add nes_ui_desktop_cursor

How to use it

Before you can use a NesIconData as a cursor, they need to be registered in the NesUIDesktopCursor instance.

To do so:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  const pixelSize = 4.0;
  const palette = [
    Colors.black,
    Colors.white,
  ];

  await NesUIDesktopCursor.instance.addCursor(
    NesIcons.arrowCursor,
    pixelSize: pixelSize,
    palette: palette,
  );
}

Or multiple cursors can be registered with addMultipleCursors:

await NesUIDesktopCursor.instance.addMultipleCursors(
  icons: [
    NesIcons.arrowCursor,
    NesIcons.leftHand,
    NesIcons.axe,
    NesIcons.check,
  ],
  pixelSize: pixelSize,
  palette: palette,
);

Then to use the registered cursors, the Flutter MouseRegion widget can be used:

MouseRegion(
  cursor: NesUIDesktopCursor.instance.getNesCursor(
    NesIcons.leftHand,
  ),
  child: ...
),