Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added shortcut key "ctrl + s" for saving projects on the go. #493

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Rupamthxt
Copy link

@Rupamthxt Rupamthxt commented Nov 7, 2024

PR Description

Added a KeyboardListner which detects key strokes to look for any "ctrl + s" keystrike in a textFeild which in turn triggers the save button to provide ease of use.

Related Issues

Checklist

  • I have gone through the contributing guide
  • I have updated my branch and synced it with project main branch before making this PR
  • I have run the tests (flutter test) and all tests are passing

Added/updated tests?

We encourage you to add relevant test cases.

  • Yes
  • No, and this is why: As this does not interfere with any already written feature and only reuses them

Copy link
Author

@Rupamthxt Rupamthxt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great with the save functionality moved to the utils section for further reuse.

@ashitaprasad
Copy link
Member

The current approach is not the best.
You should take a look at shortcuts and actions available in MaterialApp.

References:

@Rupamthxt
Copy link
Author

I did but that has the same issue, whenever you are within a text field it works fine but apart from that ctrl + s is not detected. I tried using an arrow key and that works just fine.

@ashitaprasad
Copy link
Member

Did you try the approach on a simple flutter app first?

@Rupamthxt
Copy link
Author

I tried implementing in this app itself, but will try on a simple app and give an update accordingly.

@ashitaprasad
Copy link
Member

@Rupamthxt I have updated the code .. You can investigate why it is not working and make any improvements that work in the DesktopDashboard() widget.
Do not modify the Dashboard() widget.

@Rupamthxt
Copy link
Author

@ashitaprasad Alright! Will take care of that

@Rupamthxt
Copy link
Author

@ashitaprasad Just found out the issue was due to problems with the focus of widgets, fixed it there. Now ctrl + s works from everywhere.

@ashitaprasad
Copy link
Member

@Rupamthxt In my last comment I had clearly specified not to modify the Dashboard() widget.
Why have you not made the changes in the DesktopDashboard() widget?

@Rupamthxt
Copy link
Author

@ashitaprasad I think I misunderstood it. Working on it. But adding the FocusScope() to DesktopDashboard() is not handling the keyStrokes correctly. Is it possible to keep the FocusScope() inside the Dashboard() widget ?

@ashitaprasad
Copy link
Member

ashitaprasad commented Nov 12, 2024

Update the PR with what is currently working at your end with minimal changes to Dashboard() widget.

@Rupamthxt
Copy link
Author

Rupamthxt commented Nov 12, 2024

@ashitaprasad This is the most minimal change that could have been done.

@ashitaprasad
Copy link
Member

Launch app -> Ctrl+S -> Save works
Click on a Request -> Click on three dots -> click rename -> rename request -> click outside -> Ctrl+S -> Save does not work.

@Rupamthxt
Copy link
Author

This works on my end. I tested the build version as well.

@ashitaprasad
Copy link
Member

It is not working on macOS. What is your OS?

@Rupamthxt
Copy link
Author

I develop on windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add keyboard shortcut for the "Save" action
2 participants