isModifierPressed method
- ModifierKey key, {
- KeyboardSide side = KeyboardSide.any,
override
Returns true if the given ModifierKey was pressed at the time of this event.
This method is deprecated and will be removed. For equivalent information, inspect HardwareKeyboard.logicalKeysPressed instead.
If side
is specified, then this restricts its check to the specified
side of the keyboard. Defaults to checking for the key being down on
either side of the keyboard. If there is only one instance of the key on
the keyboard, then side
is ignored.
Implementation
@override
bool isModifierPressed(ModifierKey key, {KeyboardSide side = KeyboardSide.any}) {
return switch (key) {
ModifierKey.controlModifier => metaState & modifierControl != 0,
ModifierKey.shiftModifier => metaState & modifierShift != 0,
ModifierKey.altModifier => metaState & modifierAlt != 0,
ModifierKey.metaModifier => metaState & modifierMeta != 0,
ModifierKey.numLockModifier => metaState & modifierNumLock != 0,
ModifierKey.capsLockModifier => metaState & modifierCapsLock != 0,
ModifierKey.scrollLockModifier => metaState & modifierScrollLock != 0,
// On Web, the browser doesn't report the state of the FN and SYM modifiers.
ModifierKey.functionModifier || ModifierKey.symbolModifier => false,
};
}