0

I've been working with Shortcuts, Actions and key binds with Flutter web. And I've found a weird behaviour that I can't find a solution to.

The thing is, I have defined a series of LogicalKeySet for a set of actions. I create 2 per action, one for windows and one for mac. They look something like this:

final boldKeySetWindows = LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyB);
final boldKeySetMac = LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyB);

I add them to the Actions widget as specified here.

final boldKeySetWindows = LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyB);
final boldKeySetMac = LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyB);

Shortcuts(
  shortcuts: {
    boldKeySetWindows: MEFormatIntent(boldFormatter),
    boldKeySetMac: MEFormatIntent(boldFormatter),
  },
  child: Actions(
    dispatcher: MEFormatActionDispatcher(),
    actions: <Type, Action<Intent>>{
      MEFormatIntent: MEFormatAction(_controller),
    },
  )
);

The problem or weird behaviour is the following, for windows (using control) it works fine, it only executes MEFormatAction when both ctrl and b are pressed.

But if I try using the meta key or key plus b it works correctly the first time you press cmd+b, but after that, if I quickly press cmd again, it executes MEFormatAction again. (This behaviour does not happen with ctrl)

Am I missing something, or is this a bug?

I have not tried anything as I have been unsuccessful in finding information regarding this behaviour, any help or advice is highly appreciated!

1 Answer 1

0

It's a known issue/behaviour, it seems an issue with MacOS, more information can be found here and here

But the solution is to use, SingleActivator instead of LogicalKeySet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.