shortcuts_display 1.0.0 copy "shortcuts_display: ^1.0.0" to clipboard
shortcuts_display: ^1.0.0 copied to clipboard

A Flutter library for visually displaying keyboard shortcuts on the screen.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:flutter/services.dart';
import 'package:shortcuts_display/shortcuts_display.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  MyHomePageState createState() => MyHomePageState();
}

class MyHomePageState extends State<MyHomePage> {
  int count = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color.fromARGB(255, 21, 25, 43),
      body: ShortcutsDisplay(
        bindings: {
          const SingleActivator(LogicalKeyboardKey.arrowUp): () {
            setState(() {
              count++;
            });
          },
          const SingleActivator(LogicalKeyboardKey.arrowDown): () {
            setState(() {
              count--;
            });
          },
          const SingleActivator(LogicalKeyboardKey.escape): () {
            setState(() {
              count--;
            });
          },
        },
        child: Center(
          child: Text(
            "$count",
            style: const TextStyle(
              color: Colors.white,
              fontSize: 50,
            ),
          ),
        ),
      ),
    );
  }
}
2
likes
150
points
34
downloads

Publisher

verified publisherrafazr.dev

Weekly Downloads

A Flutter library for visually displaying keyboard shortcuts on the screen.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on shortcuts_display