0 purchases
dotup flutter shortcuts
dotup_flutter_shortcuts #
Widget to handle shortcuts easy. With actions and intents.
Usage #
Usage example:
import 'package:dotup_flutter_shortcuts/dotup_flutter_shortcuts.dart';
// Is called with Ctrl + S
class ScreenshotAction extends Action<SingleKeyPressedIntent> {
@override
Object? invoke(covariant SingleKeyPressedIntent intent) {
print('1-ScreenshotAction ${intent.key}');
}
}
// Is called with Ctrl + R and Ctrl +A
class SingleKeyPressedAction extends Action<SingleKeyPressedIntent> {
@override
Object? invoke(covariant SingleKeyPressedIntent intent) {
print('2-SingleKeyPressedAction ${intent.key}');
}
}
void main() => runApp(const MyApp());
/// Shortcuts defined here are in effect for the whole app,
/// although different widgets may fulfill them differently.
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String title = 'Shortcuts and Actions Demo';
@override
Widget build(BuildContext context) {
final shortcuts = [
SingleKeyShortcutDescriptor(
action: SingleKeyPressedAction(),
keySet: LogicalKeySet(LogicalKeyboardKey.keyR, LogicalKeyboardKey.keyA),
control: true,
// meta: true,
),
SingleKeyShortcutDescriptor(
action: ScreenshotAction(),
keySet: LogicalKeySet(LogicalKeyboardKey.keyS),
control: true,
),
];
return SingleKeyShortcut(
shortcutDescriptors: shortcuts,
child: MaterialApp(
title: title,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
body: Column(
children: [
Container(width: 50, height: 50, color: Colors.red),
Container(width: 50, height: 50, color: Colors.blue),
Container(width: 50, height: 50, color: Colors.yellow),
Container(width: 50, height: 50, color: Colors.amber),
Text('www.dotup.de'),
Text('www.flutter-apps.ml'),
TextField(),
],
),
),
),
);
}
}
copied to clipboard
dotup.de
install #
flutter pub add dotup_dart_geolocation_core
Links #
dotup_flutter_shortcuts on pub.dev
Other widgets on pub.dev #
Other open source flutter projects on Github #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.