designShortcutLabel function
String
designShortcutLabel(
- BuildContext context,
- MenuSerializableShortcut shortcut, {
- TargetPlatform? platform,
- bool appleSymbols = true,
designShortcutKeys joined as a menu row shows them: "⌃ ⇧ N" with Apple's symbols (Flutter's spacing), "Shift+Command+N" in words on macOS and iOS, "Ctrl+Shift+N" elsewhere.
designShortcutLabel(context, const SingleActivator(LogicalKeyboardKey.keyS, control: true))
Implementation
String designShortcutLabel(
BuildContext context,
MenuSerializableShortcut shortcut, {
TargetPlatform? platform,
bool appleSymbols = true,
}) {
final on = platform ?? defaultTargetPlatform;
final symbols =
appleSymbols && (on == TargetPlatform.macOS || on == TargetPlatform.iOS);
return designShortcutKeys(
context,
shortcut,
platform: on,
appleSymbols: appleSymbols,
).join(symbols ? ' ' : '+');
}