super_keyboard_layout 0.1.1+1 copy "super_keyboard_layout: ^0.1.1+1" to clipboard
super_keyboard_layout: ^0.1.1+1 copied to clipboard

outdated

Keyboard layout mapping for Flutter. Map between physical and logical keys according to current keyboard layout and provides notification on layout changes.

Keyboard layout mapping for Flutter #

Features #

  • Supports macOS, Windows and Linux
  • Allows mapping between physical keys, logical keys and platform specific key codes according to current keyboard layout.
  • Notification for keyboard layout changes.

Getting started #

super_keyboard_layout uses Rust internally to implement low-level platform specific functionality. Rather than shipping prebuilt binaries with the plugin, Rust build is seamlessly integrated into the Flutter build process.

To use super_keyboard_layout, you will need to install Rust:

For macOS or Linux, execute the following command in Terminal.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

For Windows, you can use the Rust Installer.

In case you have Rust already installed, make sure to update it to latest version:

rustup update

That is it. The build integration will automatically install required Rust toolchains and other dependencies. This also means that first build might take a little bit longer.

Usage #


import 'package:super_keyboard_layout/super_keyboard_layout.dart';

void main() async {
    final manager = await KeyboardLayoutManager.instance();
    if (manager.supported) {
        // Running on supported platform
        manager.onLayoutChanged.addListener(() {
            // Keyboard layout changed
            print('Keyboard layout changed');
        });
    }

    final layout = manager.currentLayout;

    // Getting logical key for physical key 1 with shift for current layout
    final logicalKey = layout.getLogicalKeyForPhysicalKey(PhysicalKeyboardKey.digit1, shift: true);

    // Getting physical key for logical key
    final physicalKey = layout.getPhysicalKeyForLogicalKey(LogicalKeyboardKey.keyA);

    // Getting platform spcific key code for either logical or physical key
    final playformCode = layout.getPlatformKeyCode(PhysicalKeyboardKey.digit1);
}

Running the example #

Example project is available at super_keyboard_layout/example.

flutter pub global activate melos # if you don't have melos already installed
git clone https://github.com/superlistapp/super_native_extensions.git
cd super_native_extensions
melos bootstrap

After this you can open the folder in VSCode and run the super_keyboard_layout launcher configuration.

TODO(knopp): Add Intellij launcher configuration

Additional information #

This plugin is in a very early stages of development and quite experimental.

PRs and bug reports are welcome!

4
likes
0
pub points
64%
popularity

Publisher

verified publishernativeshell.dev

Keyboard layout mapping for Flutter. Map between physical and logical keys according to current keyboard layout and provides notification on layout changes.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, super_native_extensions

More

Packages that depend on super_keyboard_layout