305 :(NSDictionary*)representation {
306 if ([(NSNumber*)([representation valueForKey:kDividerKey]) intValue] == YES) {
307 return [NSMenuItem separatorItem];
308 }
309 NSNumber* platformProvidedMenuId = representation[kPlatformProvidedMenuKey];
310 NSString* keyEquivalent = @"";
311
312 if (platformProvidedMenuId) {
313 return [self
314 createPlatformProvidedMenu:(flutter::PlatformProvidedMenu)platformProvidedMenuId.intValue];
315 } else {
317 keyEquivalent = representation[kShortcutCharacterKey];
318 } else {
319 NSNumber* triggerKeyId = representation[kShortcutTriggerKey];
321 NSNumber* trigger = specialKeys[triggerKeyId];
322 if (trigger) {
323 keyEquivalent = [NSString stringWithFormat:@"%C", [trigger unsignedShortValue]];
324 } else {
327 keyEquivalent = [[NSString
328 stringWithFormat:@"%C", (unichar)([triggerKeyId unsignedLongLongValue] &
329 kFlutterKeyIdValueMask)] lowercaseString];
330 }
331 }
332 }
333 }
334
335 NSNumber*
identifier = representation[kIdKey];
337 NSString* appName = [NSRunningApplication currentApplication].localizedName;
338 NSString* title = [representation[kLabelKey] stringByReplacingOccurrencesOfString:kAppName
339 withString:appName];
340 NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:title
341 action:action
342 keyEquivalent:keyEquivalent];
343 if ([keyEquivalent
length] > 0) {
344 item.keyEquivalentModifierMask =
346 }
349 item.target = self;
350 }
351 NSNumber* enabled = representation[kEnabledKey];
352 if (enabled) {
353 item.enabled = enabled.boolValue;
354 }
355
356 NSArray* children = representation[kChildrenKey];
357 if (children && children.count > 0) {
358 NSMenu* submenu = [[NSMenu alloc] initWithTitle:title];
360 channel:_channel];
361 [_menuDelegates addObject:delegate];
362 submenu.delegate = delegate;
363 submenu.autoenablesItems = NO;
364 for (NSDictionary* child in children) {
365 NSMenuItem* newItem = [self menuItemFromFlutterRepresentation:child];
366 if (newItem) {
367 [submenu addItem:newItem];
368 }
369 }
370 item.submenu = submenu;
371 }
372 return item;
373}
static SkString identifier(const FontFamilyDesc &family, const FontDesc &font)