pluto_grid icon indicating copy to clipboard operation
pluto_grid copied to clipboard

Fix Key Event Error in New Flutter Version

Open naidu199 opened this issue 1 year ago • 2 comments

This pull request addresses an issue with key event handling in the new version of Flutter. The original code caused a type error due to changes in how key events and states are managed. The updated code snippet explicitly casts " keyEvent.event " as "KeyEvent " and "state" as "HardwareKeyboard", resolving the error.

Changes Made

File Location:

lib/src/manager/shortcut/pluto_grid_shortcut.dart (line 33)

Original Code:

if (action.key.accepts(keyEvent.event, state)) {
   action.value.execute(keyEvent: keyEvent, stateManager: stateManager);
   return true;
 }

Updated Code:

if (action.key.accepts(keyEvent.event as KeyEvent, state as HardwareKeyboard)) {
  action.value.execute(keyEvent: keyEvent, stateManager: stateManager);
  return true;
}

Reason for Changes In the new version of Flutter, there were type changes that caused the original code to throw an error. By explicitly casting the types, the code is now compatible with the updated Flutter API.

The updated code has been tested and verified to work correctly without causing the previous type error.

naidu199 avatar Aug 07 '24 18:08 naidu199

Sorry for that i had forgotten to add the review

naidu199 avatar Aug 07 '24 18:08 naidu199

Make a review for this pull request

naidu199 avatar Aug 07 '24 18:08 naidu199

@naidu199 Please create this in pluto_grid_plus this repo is dead

stan-at-work avatar Dec 07 '24 14:12 stan-at-work

Yeah ok sure

naidu199 avatar Dec 07 '24 14:12 naidu199

Please close this PR, to clean up thanks

stan-at-work avatar Dec 07 '24 14:12 stan-at-work