onKey method
Used to check if ctrl or shift for scrolling is pressed
Implementation
@protected
bool onKey(KeyEvent event) {
final key = event.logicalKey;
if (key == LogicalKeyboardKey.controlLeft ||
key == LogicalKeyboardKey.controlRight) {
if (event is KeyDownEvent || event is KeyRepeatEvent) {
_ctrlPressed = true;
} else if (event is KeyUpEvent) {
_ctrlPressed = false;
}
}
if (key == LogicalKeyboardKey.shiftLeft ||
key == LogicalKeyboardKey.shiftRight) {
if (event is KeyDownEvent || event is KeyRepeatEvent) {
_shiftPressed = true;
} else if (event is KeyUpEvent) {
_shiftPressed = false;
}
}
return false;
}