Skip to content

Conversation

@sichang824
Copy link

@sichang824 sichang824 commented Dec 19, 2025

What

  • Add macOS support for per-menu-item icons in tray menus via MenuItem.icon.

How

  • On macOS, setContextMenu now loads MenuItem.icon from Flutter assets, encodes it as base64, and sends it to native as base64Icon.
  • Native macOS (TrayMenu.swift) decodes base64Icon and sets NSMenuItem.image.
  • Fallback: if base64Icon is unavailable, treat icon as an absolute file path (best-effort).

Demo

  • Updated example menu items to include: icon: images/tray_icon.png
  • Added screenshots:
    • screenshots/macos_icon.png
    • screenshots/macos_icon1.png

Notes

  • Other platforms may ignore MenuItem.icon for now.

Render per-menu-item icons in macOS tray menus by passing icon assets as base64 to native and setting NSMenuItem.image.\n\nAlso update example and docs to demonstrate MenuItem.icon usage.
Use GitHub raw links for screenshots, avoid manual doctoc edits, add changelog entry, and cache base64 icon encoding on macOS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant