dotup_flutter_shortcuts 2.0.2 copy "dotup_flutter_shortcuts: ^2.0.2" to clipboard
dotup_flutter_shortcuts: ^2.0.2 copied to clipboard

Widget to handle shortcuts easy. With actions and intents.

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(),
            ],
          ),
        ),
      ),
    );
  }
}

dotup.de

install #

flutter pub add dotup_dart_geolocation_core

dotup_flutter_shortcuts on pub.dev

Other widgets on pub.dev #

Other open source flutter projects on Github #

1
likes
70
pub points
3%
popularity

Publisher

verified publisherdotup.de

Widget to handle shortcuts easy. With actions and intents.

Homepage

Documentation

API reference

License

GPL-3.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on dotup_flutter_shortcuts