legacy_keyboard_shortcut_decoration 0.0.6 copy "legacy_keyboard_shortcut_decoration: ^0.0.6" to clipboard
legacy_keyboard_shortcut_decoration: ^0.0.6 copied to clipboard

A Flutter package to display keyboard shortcuts with a nice, key-like decoration.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:legacy_keyboard_shortcut_decoration/legacy_keyboard_shortcut_decoration.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'LegacyKeyboardShortcutDecoration Example',
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      themeMode: ThemeMode.system,
      home: const MyHomePage(),
    );
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final _textController = TextEditingController();
  bool _showIndividualKeys = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('LegacyKeyboardShortcutDecoration Example'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          children: [
            TextField(
              controller: _textController,
              decoration: const InputDecoration(
                labelText: 'Enter shortcut',
                hintText: 'e.g. Ctrl+S',
              ),
              onChanged: (value) {
                setState(() {});
              },
            ),
            const SizedBox(height: 20),
            Row(
              children: [
                const Text('Show individual keys'),
                Switch(
                  value: _showIndividualKeys,
                  onChanged: (value) {
                    setState(() {
                      _showIndividualKeys = value;
                    });
                  },
                ),
              ],
            ),
            const SizedBox(height: 20),
            if (_textController.text.isNotEmpty)
              LegacyKeyboardShortcut(
                key: const Key('shortcut_from_textfield'),
                shortcut: _textController.text,
                showIndividualKeys: _showIndividualKeys,
              ),
            const SizedBox(height: 20),
            const Text('Examples:'),
            const SizedBox(height: 10),
            const LegacyKeyboardShortcut(shortcut: 'F+ctrl'),
            const SizedBox(height: 10),
            const LegacyKeyboardShortcut(shortcut: 'ALT+SHIFT+T'),
            const SizedBox(height: 10),
            const LegacyKeyboardShortcut(shortcut: 'F11+ALT'),
          ],
        ),
      ),
    );
  }
}
3
likes
160
points
302
downloads
screenshot

Publisher

verified publisherlegacy-automation.online

Weekly Downloads

A Flutter package to display keyboard shortcuts with a nice, key-like decoration.

Repository (GitHub)
View/report issues

Topics

#flutter #keyboard #shortcuts #ui #widget

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on legacy_keyboard_shortcut_decoration