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

feat: support for xiaomi smart pen #1132

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

Conversation

arpandaze
Copy link
Contributor

@arpandaze arpandaze commented Feb 20, 2024

First of all I would like to thank you for this amazing project. Its perfect for my purpose. My only concern was that my Pen for Xiaomi Pad 6 wasn't supported. I took a look around the code base to implement support for the pen. Seems like you already have support for keyboard and since Xiaomi pen keys works as Page Up and Down, I have updated a few things to support the pen.

Changes made:

  1. Implemented function to toggle between primary and secondary pinned colors.
  2. Bind PageUp to toggle colors and PageDown to toggle eraser.
  3. Workaround for keybind not working after defocus/minimization.

About the workaround:
For some reason, keybinds only works after virtual keyboard is opened at least once. I am currently fixing this by doing this:

SystemChannels.textInput.invokeMethod('TextInput.show');
SystemChannels.textInput.invokeMethod('TextInput.hide');

To be fair I am not too experienced in flutter but I tried various ways but none seemed to work. You might know better way to handle this. Let me know what to change to fix that if you have ideas. But this workaround has been perfectly working for me and keyboard doesn't even show up since show and hide happen one after another.

@arpandaze arpandaze changed the title Support for Xiaomi Smart Pen feat: support for xiaomi smart pen Feb 20, 2024
Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Attention: 38 lines in your changes are missing coverage. Please review.

Comparison is base (2baa6e5) 37.31% compared to head (f4317ed) 37.31%.

Files Patch % Lines
lib/pages/editor/editor.dart 50.00% 24 Missing ⚠️
lib/components/toolbar/toolbar.dart 33.33% 14 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1132   +/-   ##
=======================================
  Coverage   37.31%   37.31%           
=======================================
  Files         108      108           
  Lines        8498     8524   +26     
=======================================
+ Hits         3171     3181   +10     
- Misses       5327     5343   +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

None yet

1 participant