utils/popup_menu_encoder library
Functions
-
encodePopupMenuEntries(
List< CNPopupMenuEntry> entries, {required int? resolveColor(Color? color), Map<PopupMenuIconKey, Uint8List?> customIconBytes = const {}, Map<CNPopupMenuEntry, String> assetPaths = const {}, bool includeCustomIcons = true}) → Map<String, Object?> -
Encodes popup menu
entriesinto the parallel arrays the native popup menu views read. -
popupMenuEntryVisual(
CNPopupMenuEntry entry) → PopupMenuEntryVisual? -
The visual fields of
entry, or null for a divider. -
popupMenuIconKey(
CNPopupMenuEntry entry) → PopupMenuIconKey? -
The key of
entry's custom icon, or null when it has none to render (an image asset takes precedence over a custom icon). -
walkPopupMenuEntries(
List< CNPopupMenuEntry> entries) → Iterable<CNPopupMenuEntry> -
Every entry of
entriesand of their submenus, depth first.
Typedefs
- PopupMenuEntryVisual = ({IconData? customIcon, bool enabled, CNSymbol? icon, Color? iconColor, CNImageAsset? imageAsset, String label, String? subtitle})
- What a selectable or expandable popup menu entry shows: the fields CNPopupMenuItem and CNPopupMenuSubmenu have in common.
- PopupMenuIconKey = ({Color color, IconData icon, double size})
-
What a rendered custom icon depends on. Rendered icons are kept by this
key, not by entry: items built in
build()are new objects on every build, and an unchanged icon must still be found in the next build's.