doonfrs / pluto_grid_plus

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
18 stars 20 forks source link

[Bug] Build Error 'RawKeyEvent' can't be assigned to the parameter type 'KeyEvent' #6

Closed AndreLuizNogueira closed 6 months ago

AndreLuizNogueira commented 7 months ago

I created a new blank application to test plutogrid, imported it, copied the code from the readme page but I can't build it, I also tried the code from the example page but the same error occurs. I've already tried flutter clean, older version of plutogrid, restarted vscode, tried running on edge, chrome and windows. I even downloaded the code and tried running the example application

POSSIBLE SOLUTION I Opened the pluto grid code and it had only 1 error on pluto_grid_shortcut.dart at line 33, and the quickfix worked for me

it changed:

if (action.key.accepts(keyEvent.event, state))

to

if (action.key.accepts(keyEvent.event as KeyEvent, state as HardwareKeyboard))

I don't know if that is the correct fix, but can you check it out ?

Steps to reproduce the bug

Create new Project and import sample code from readme

Expected results

build

Actual results

Launching lib\main.dart on Windows in debug mode... /C:/Users/.../pluto_grid_plus-8.2.0/lib/src/manager/shortcut/pluto_grid_shortcut.dart(33,39): error GC2F972A8: The argument type 'RawKeyEvent' can't be assigned to the parameter type 'KeyEvent'. [D:\test\grid\pluto\plutogrid\build\windows\x64\flutter\flutter_assemble.vcxproj] /C:/Users/.../pluto_grid_plus-8.2.0/lib/src/manager/shortcut/pluto_grid_shortcut.dart(33,46): error GC2F972A8: The argument type 'RawKeyboard' can't be assigned to the parameter type 'HardwareKeyboard'. [D:\test\grid\pluto\plutogrid\build\windows\x64\flutter\flutter_assemble.vcxproj]

Execution Environment

Flutter version Channel beta, 3.19.0-0.4.pre environment: sdk: '>=3.3.0-279.3.beta <4.0.0'

PlutoGrid version 8.2.0 -->

OS Windows 11

ecoant commented 6 months ago

Hi! Someone submitted a PR to fix this on the old repo back when it was only an issue with Flutter Web https://github.com/bosskmk/pluto_grid/pull/979