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

[Bug] PlutoGridShortcut and arrow keys not working on linux #1122

Open
itsnotmeman opened this issue Nov 21, 2024 · 4 comments
Open

[Bug] PlutoGridShortcut and arrow keys not working on linux #1122

itsnotmeman opened this issue Nov 21, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@itsnotmeman
Copy link

Steps to reproduce the bug

Just run the following code on a linux system.

Expected results

Being able to move the focused cell with the arrow keys.
If I press shift, "Shift pressed" should be printed.

Actual results

Nothing happens.

Code sample

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:pluto_grid/pluto_grid.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'PlutoGrid Example',
      home: Scaffold(
        appBar: AppBar(title: const Text('PlutoGrid Example')),
        body: const SimplePlutoGrid(),
      ),
    );
  }
}

class SimplePlutoGrid extends StatelessWidget {
  const SimplePlutoGrid({super.key});

  @override
  Widget build(BuildContext context) {
    // Define the columns for the grid
    final List<PlutoColumn> columns = [
      PlutoColumn(
        title: 'ID',
        field: 'id',
        minWidth: 40,
        width: 40,
        enableContextMenu: false,
        enableDropToResize: false,
        type: PlutoColumnType.number(),
      ),
      PlutoColumn(
        title: 'Name',
        field: 'name',
        type: PlutoColumnType.text(),
      ),
      PlutoColumn(
        title: 'Age',
        field: 'age',
        type: PlutoColumnType.number(),
      ),
    ];

    // Define the rows for the grid
    final List<PlutoRow> rows = [
      PlutoRow(cells: {
        'id': PlutoCell(value: 1),
        'name': PlutoCell(value: 'Alice'),
        'age': PlutoCell(value: 25),
      }),
      PlutoRow(cells: {
        'id': PlutoCell(value: 2),
        'name': PlutoCell(value: 'Bob'),
        'age': PlutoCell(value: 30),
      }),
      PlutoRow(cells: {
        'id': PlutoCell(value: 3),
        'name': PlutoCell(value: 'Charlie'),
        'age': PlutoCell(value: 35),
      }),
    ];

    return PlutoGrid(
      columns: columns,
      rows: rows,
      onChanged: (event) {
        print('changed');
      },
      configuration: PlutoGridConfiguration(
        enableMoveHorizontalInEditing: true, // Allow horizontal navigation
        shortcut: PlutoGridShortcut(
          actions: {
            ...PlutoGridShortcut.defaultActions,
            LogicalKeySet(LogicalKeyboardKey.shift): CustomShiftKeyAction(),
          }
        )
      ),
    );
  }
}
// Override shift key action to enable to start
// typing in uppercase in a PlutoGrid cell.
class CustomShiftKeyAction extends PlutoGridShortcutAction {
  @override
  void execute({
    required PlutoKeyManagerEvent keyEvent,
    required PlutoGridStateManager stateManager,
  }) {
    stateManager.setEditing(true);
    print('Shift pressed');
  }
}

Execution Environment

Flutter version
Flutter version is 3.24.5

PlutoGrid version
PlutoGrid version is 8.0.0

OS
Ubuntu 22.04.5

@itsnotmeman itsnotmeman added the bug Something isn't working label Nov 21, 2024
@stan-at-work
Copy link

stan-at-work commented Dec 7, 2024

@itsnotmeman There was an issue with identifing key presses in particular shift, ctrl combinations.

I created a PR for this issue in doonfrs#107

This will fix your issue i think 86.567% sure

Please check that out if that fixes this

@itsnotmeman
Copy link
Author

@stan-at-work Thanks for the PR. Unfortunately it does not fix the issue.

@stan-at-work
Copy link

@stan-at-work Thanks for the PR. Unfortunately it does not fix the issue.

Alright i cant test it on linux, could you send a detailed stacktrace and or debugging information. A videa would be great.

Can't prommise anything but maybe wa can work it out.

@itsnotmeman
Copy link
Author

The program doesn't crash. It just ignores any pressed arrow, shift and enter key.

I compile the program in WSL2. But I also tried to run the binary in a linux VM and it doesn't work neither.

flutter run --verbose
[   +7 ms] Unable to locate an Android SDK.
[   +4 ms] executing: uname -m
[   +1 ms] Exit code 0 from: uname -m
[        ] x86_64
[  +51 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +44 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[  +35 ms] Skipping pub get: version match.
[ +128 ms] Generating /home/username/test/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java
[  +53 ms] No packages with native assets. Skipping native assets compilation.
[   +1 ms] Initializing file store
[   +4 ms] Skipping target: gen_localizations
[   +2 ms] gen_dart_plugin_registrant: Starting due to {InvalidatedReasonKind.inputChanged: The following inputs have updated contents: /home/username/test/.dart_tool/package_config_subset}
[  +25 ms] gen_dart_plugin_registrant: Complete
[        ] Skipping target: _composite
[        ] complete
[   +2 ms] Launching lib/main.dart on Linux in debug mode...
[   +1 ms] /home/username/development/flutter/bin/cache/dart-sdk/bin/dartaotruntime --disable-dart-dev /home/username/development/flutter/bin/cache/dart-sdk/bin/snapshots/frontend_server_aot.dart.snapshot --sdk-root
/home/username/development/flutter/bin/cache/artifacts/engine/common/flutter_patched_sdk/ --incremental --target=flutter --experimental-emit-debug-metadata --output-dill /tmp/flutter_tools.RGGOIZ/flutter_tool.ASIISM/app.dill
--packages /home/username/test/.dart_tool/package_config.json -Ddart.vm.profile=false -Ddart.vm.product=false --enable-asserts --track-widget-creation --filesystem-scheme org-dartlang-root --initialize-from-dill
build/cache.dill.track.dill --verbosity=error --enable-experiment=alternative-invalidation-strategy
[  +14 ms] Building Linux application...
[   +5 ms] <- compile package:test/main.dart
[   +1 ms] executing: [build/linux/x64/debug/] cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DFLUTTER_TARGET_PLATFORM=linux-x64 /home/username/test/linux
[  +64 ms] -- Configuring done
[   +9 ms] -- Generating done
[   +4 ms] -- Build files have been written to: /home/username/test/build/linux/x64/debug
[   +9 ms] executing: ninja -C build/linux/x64/debug install
[   +3 ms] ninja: Entering directory `build/linux/x64/debug'
[+1461 ms] [1/5] Generating /home/username/test/linux/flutter/ephemeral/libflutter_linux_gtk.so, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_basic_message_channel.h,
/home/username/test/linux/flutter/ephemeral/flutter_linux/fl_binary_codec.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_binary_messenger.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_dart_project.h,
/home/username/test/linux/flutter/ephemeral/flutter_linux/fl_engine.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_json_message_codec.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_json_method_codec.h,
/home/username/test/linux/flutter/ephemeral/flutter_linux/fl_message_codec.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_method_call.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_method_channel.h,
/home/username/test/linux/flutter/ephemeral/flutter_linux/fl_method_codec.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_method_response.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_plugin_registrar.h,
/home/username/test/linux/flutter/ephemeral/flutter_linux/fl_plugin_registry.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_standard_message_codec.h,
/home/username/test/linux/flutter/ephemeral/flutter_linux/fl_standard_method_codec.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_string_codec.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/fl_value.h,
/home/username/test/linux/flutter/ephemeral/flutter_linux/fl_view.h, /home/username/test/linux/flutter/ephemeral/flutter_linux/flutter_linux.h, _phony_
[   +2 ms] [   +5 ms] Unable to locate an Android SDK.
[        ] [   +5 ms] executing: uname -m
[        ] [   +1 ms] Exit code 0 from: uname -m
[        ] [        ] x86_64
[        ] [  +30 ms] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[        ] [   +1 ms] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [  +43 ms] Artifact Instance of 'MaterialFonts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'GradleWrapper' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidGenSnapshotArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'AndroidInternalBuildArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterWebSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LegacyCanvasKitRemover' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterSdk' is not required, skipping update.
[        ] [        ] Artifact Instance of 'WindowsEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSEngineArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'LinuxFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'MacOSFuchsiaSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerSDKArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FlutterRunnerDebugSymbols' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'IosUsbArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'FontSubsetArtifacts' is not required, skipping update.
[        ] [        ] Artifact Instance of 'PubDependencies' is not required, skipping update.
[        ] [  +10 ms] Initializing file store
[        ] [   +5 ms] Done initializing file store
[        ] [  +25 ms] Skipping target: gen_localizations
[        ] [   +4 ms] Skipping target: gen_dart_plugin_registrant
[        ] [ +350 ms] Skipping target: unpack_linux
[        ] [ +252 ms] Skipping target: kernel_snapshot_program
[        ] [   +2 ms] Skipping target: native_assets
[        ] [        ] Skipping target: kernel_snapshot_native_assets
[        ] [        ] Skipping target: kernel_snapshot
[        ] [ +351 ms] Skipping target: debug_bundle_linux-x64_assets
[        ] [        ] Persisting file store
[        ] [   +4 ms] Done persisting file store
[        ] [   +6 ms] build succeeded.
[        ] [   +6 ms] "flutter assemble" took 1,069ms.
[        ] [  +87 ms] ensureAnalyticsSent: 85ms
[        ] [        ] Running 1 shutdown hook
[        ] [        ] Shutdown hooks complete
[        ] [        ] exiting with code 0
[ +621 ms] [2/5] Building CXX object CMakeFiles/test.dir/flutter/generated_plugin_registrant.cc.o
[  +26 ms] [3/5] Building CXX object CMakeFiles/test.dir/my_application.cc.o
[  +88 ms] [4/5] Linking CXX executable intermediates_do_not_run/test
[        ] [4/5] Install the project...
[   +3 ms] -- Install configuration: "Debug"
[   +6 ms] -- Installing: /home/username/test/build/linux/x64/debug/bundle/test
[        ] -- Set runtime path of "/home/username/test/build/linux/x64/debug/bundle/test" to "$ORIGIN/lib"
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/icudtl.dat
[   +1 ms] -- Installing: /home/username/test/build/linux/x64/debug/bundle/lib/libflutter_linux_gtk.so
[  +27 ms] -- Up-to-date: /home/username/test/build/linux/x64/debug/bundle/lib
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/packages
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/packages/cupertino_icons
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/packages/cupertino_icons/assets
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/packages/cupertino_icons/assets/CupertinoIcons.ttf
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/NOTICES.Z
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/kernel_blob.bin
[  +28 ms] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/fonts
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/fonts/MaterialIcons-Regular.otf
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/AssetManifest.bin
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/version.json
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/AssetManifest.json
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/FontManifest.json
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/shaders
[        ] -- Installing: /home/username/test/build/linux/x64/debug/bundle/data/flutter_assets/shaders/ink_sparkle.frag
[   +6 ms] Building Linux application... (completed in 2,376ms)
[   +1 ms] ✓ Built build/linux/x64/debug/bundle/test
[ +509 ms] VM Service URL on device: http://127.0.0.1:34073/IakoXWP4yM8=/
[   +1 ms] Caching compiled dill
[  +29 ms] Connecting to service protocol: http://127.0.0.1:34073/IakoXWP4yM8=/
[  +62 ms] Launching a Dart Developer Service (DDS) instance at http://127.0.0.1:0, connecting to VM service at http://127.0.0.1:34073/IakoXWP4yM8=/.
[  +46 ms] DDS is listening at http://127.0.0.1:46483/_ziBfjRfAss=/.
[  +31 ms] Successfully connected to service protocol: http://127.0.0.1:34073/IakoXWP4yM8=/
[  +14 ms] DevFS: Creating new filesystem on the device (null)
[   +6 ms] DevFS: Created new filesystem on the device (file:///tmp/testORMSSS/test/)
[   +1 ms] Updating assets
[  +64 ms] Syncing files to device Linux...
[   +1 ms] Compiling dart to kernel with 0 updated files
[        ] Processing bundle.
[        ] <- recompile package:test/main.dart b6825ee0-5c51-4ef6-a434-98bd4dff4400
[        ] <- b6825ee0-5c51-4ef6-a434-98bd4dff4400
[        ] Bundle processing done.
[  +28 ms] Updating files.
[        ] Pending asset builds completed. Writing dirty entries.
[        ] DevFS: Sync finished
[        ] Syncing files to device Linux... (completed in 31ms)
[        ] Synced 0.0MB.
[        ] <- accept
[   +1 ms] Connected to _flutterView/0x559a62574fc0.
[   +1 ms] Flutter run key commands.
[        ] r Hot reload. 🔥🔥🔥
[        ] R Hot restart.
[        ] h List all available interactive commands.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] A Dart VM Service on Linux is available at: http://127.0.0.1:46483/_ziBfjRfAss=/
[ +211 ms] The Flutter DevTools debugger and profiler on Linux is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:46483/_ziBfjRfAss=/
[+14354 ms] flutter: changed
[+3468 ms] Service protocol connection closed.
[        ] Lost connection to device.
[        ] DevFS: Deleting filesystem on the device (file:///tmp/testORMSSS/test/)
[        ] DevFS: Deleted filesystem on the device (file:///tmp/testORMSSS/test/)
[   +1 ms] "flutter run" took 21,561ms.
[  +66 ms] ensureAnalyticsSent: 63ms
[        ] Running 2 shutdown hooks
[   +4 ms] Shutdown hooks complete
[        ] exiting with code 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants