In my Flutter application I was trying to add custom Keyboard shortcuts like I used File Picker for attaching images . Now, I want to do that using Keyboard shortcut like "Ctrl + I" which returns that file picker widget and then runs that widget in background which asks to add the image.
I tried using various in built widgets like Focus, Keyboard Listener , HardwareKeyboard and FocusableActionDetector class but nothing worked in the way I wanted it to. As I am a beginner I want to know if I am missing out on some stuff.
Checkout CallbackShortcuts class (https://api.flutter.dev/flutter/widgets/CallbackShortcuts-class.html). Wrap it around your widget tree, use Focus a and pass commands you want to implement. For example for Ctrl + I it would be:
It’s a simpler widget than Shortcuts (https://api.flutter.dev/flutter/widgets/Shortcuts-class.html) but it does the work so if you’re a beginner CallbackShortcuts is a good choice
Hope that helps