ctrl_alt_foo2 0.4.0 ctrl_alt_foo2: ^0.4.0 copied to clipboard
For creating simple keyboard shortcuts.
Ctrl Alt Foo #
Make it easy to listen for keyboard shortcuts / accelator keys.
Usage #
This is an early preview release and the syntax is not settled. Please add issues in the tracker if you have suggestions.
import 'package:ctrl_alt_foo2/keys.dart';
Keys.shortcuts({
'Esc': (){ _hideMenu(); _hideDialog(); },
'Ctrl+N': ()=> new NewProjectDialog(this).open(),
'Ctrl+O, ⌘+O': ()=> new OpenDialog(this).open(),
'Ctrl+Shift+H': ()=> toggleCode()
});
There are also some helper methods for creating keyboard events:
import 'package:ctrl_alt_foo2/helpers.dart';
typeIn('TEXT'); // will generate a keyup
hitEnter();
hitEscape();
arrowUp(); // optionally supply the number of time to arrow up
arrowDown();
type('A'); // type a single character
typeCtrl('A'); // type Ctrl+A
typeCtrlShift('A'); // type Ctrl+Shift+A
LICENSE #
This code is licensed under the MIT license. See LICENSE for more information.