debugBuildContextMenuPayload function
Map<String, Object?>
debugBuildContextMenuPayload({
- required List<
CNPopupMenuEntry> items, - required Offset position,
- required int? resolveColor(
- Color? color
- bool? isDark,
- Map<
PopupMenuIconKey, Uint8List?> customIconBytes = const {}, - Map<
CNPopupMenuEntry, String> assetPaths = const {},
Builds the method channel payload of showNativeContextMenu.
Exposed for tests: the payload is the contract shared with
CNContextMenuManager.swift on both platforms.
Implementation
@visibleForTesting
Map<String, Object?> debugBuildContextMenuPayload({
required List<CNPopupMenuEntry> items,
required Offset position,
required int? Function(Color? color) resolveColor,
bool? isDark,
Map<PopupMenuIconKey, Uint8List?> customIconBytes = const {},
Map<CNPopupMenuEntry, String> assetPaths = const {},
}) {
return <String, Object?>{
'menu': encodePopupMenuEntries(
items,
resolveColor: resolveColor,
customIconBytes: customIconBytes,
assetPaths: assetPaths,
),
'x': position.dx,
'y': position.dy,
'isDark': ?isDark,
};
}