skip to Main Content

I have a flutter web app that is Outlook style. A user can create a message and click a send button.

I want to add the ability to send using a keyboard combination like Alt+S.

I am trying to do this using the shortcuts widget with intents and actions.

The problem I am facing is that the widget where the message is composed and the widget where the send button is are sibling widgets. They have a common parent widget.

Any help would be appreciated,

Thanks

Yaron

I can get it two work if I tab to widget where the send button is but don’t understand where to place the shortcuts and action widgets if I want to get it to work between two sibling widgets.

2

Answers


  1. Chosen as BEST ANSWER

    Got it to work by wrapping the parent widget with CallbackShortcuts widgets and a focus widget: return CallbackShortcuts( bindings: { LogicalKeySet(LogicalKeyboardKey.alt, LogicalKeyboardKey.keyS): () { print( "sending request number ${widget.genreRequest.requestIdentifier}"); _handleRequestSubmit(widget.genreRequest.requestIdentifier, 1); }, }, child: Focus( autofocus: true, child: ...


  2. Your problem can be surpassed if you write your send functionality in a separate function. You can them use it in both the intent and the button.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search