Giter VIP home page Giter VIP logo

Comments (24)

darshankawar avatar darshankawar commented on July 21, 2024 1

Thanks for the report. This also works properly in macos, so the reported behavior seems specific to Linux only. We currently don't have Linux machine to replicate it, but based on the report, I'll keep the issue open and label for team's tracking.

from flutter.

LimaneGaya avatar LimaneGaya commented on July 21, 2024 1

I could reproduce this on master and beta channel

flutter doctor (master)
[✓] Flutter (Channel master, 3.23.0-13.0.pre.212, on KDE neon 6.0 6.5.0-35-generic, locale fr_FR.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] Connected device (2 available)
[✓] Network resources
flutter doctor (beta)
[✓] Flutter (Channel beta, 3.23.0-0.1.pre, on KDE neon 6.0 6.5.0-35-generic, locale fr_FR.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] Connected device (2 available)
[✓] Network resources

from flutter.

LimaneGaya avatar LimaneGaya commented on July 21, 2024 1

Not sure if this will help pinpoint where the issue is but i managed to make it work on the master branch by switching from x11 to wayland.
I use Kde neon and it allows to switch between x11 and wayland when login in.
Tried on x11 and didn't work then logged out and try again in wayland and it worked find.

flutter doctor -v
[✓] Flutter (Channel master, 3.23.0-13.0.pre.239, on KDE neon 6.0 6.5.0-35-generic, locale fr_FR.UTF-8)
    • Flutter version 3.23.0-13.0.pre.239 on channel master at /home/gaya/software/flutter_dev
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 1c77696615 (il y a 3 jours), 2024-06-14 11:57:23 -0700
    • Engine revision 8167dffd19
    • Dart version 3.5.0 (build 3.5.0-254.0.dev)
    • DevTools version 2.36.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/gaya/software/androidsdk/
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /home/gaya/software/androidsdk/
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.11+9-Ubuntu-122.04.1)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1.1
    • cmake version 3.29.0
    • ninja version 1.10.1
    • pkg-config version 1.8.0

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • KDE neon 6.0 6.5.0-35-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 126.0.6478.61

[✓] Network resources
    • All expected network resources are available.

from flutter.

gspencergoog avatar gspencergoog commented on July 21, 2024 1

I mean, that will work, but it will disregard focus, so it will send you keys regardless of what widget has focus.

Does it work if you just use the Focus Widget? Something like this:

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  void _decrementCounter() {
    setState(() {
      _counter--;
    });
  }

  KeyEventResult _handleKeyEvent(FocusNode node, KeyEvent event) {
    if (event is KeyDownEvent) {
      if (event.logicalKey == LogicalKeyboardKey.keyA &&
          HardwareKeyboard.instance.logicalKeysPressed.contains(LogicalKeyboardKey.controlLeft)) {
        _incrementCounter();
        return KeyEventResult.handled;
      }
      if (event.logicalKey == LogicalKeyboardKey.keyB &&
          HardwareKeyboard.instance.logicalKeysPressed.contains(LogicalKeyboardKey.controlLeft)) {
        _decrementCounter();
        return KeyEventResult.handled;
      }
    }
    return KeyEventResult.ignored;
  }

  @override
  Widget build(BuildContext context) {
    return Focus(
      autofocus: true,
      onKeyEvent: _handleKeyEvent,
      child: Scaffold(
        appBar: AppBar(
          backgroundColor: Theme
              .of(context)
              .colorScheme
              .inversePrimary,
          title: Text(widget.title),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              const Text(
                'You have pushed the button this many times:',
              ),
              Text(
                '$_counter',
                style: Theme
                    .of(context)
                    .textTheme
                    .headlineMedium,
              ),
            ],
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: _incrementCounter,
          tooltip: 'Increment',
          child: const Icon(Icons.add),
        ),
      ),
    );
  }
}

from flutter.

justinmc avatar justinmc commented on July 21, 2024

@LimaneGaya Thanks for reproducing!

from flutter.

justinmc avatar justinmc commented on July 21, 2024

FYI @gspencergoog for FocusableActionDetector.

from flutter.

gspencergoog avatar gspencergoog commented on July 21, 2024

Hmm. I just tried this on Linux and it didn't reproduce for me.

Details
[✓] Flutter (Channel main, 3.23.0-13.0.pre.229, on Debian GNU/Linux rodete 6.6.15-2rodete2-amd64, locale en_US.UTF-8)
    • Flutter version 3.23.0-13.0.pre.229 on channel main at /usr/local/home/username/code/flutter
    • Upstream repository [email protected]:flutter/flutter.git
    • Framework revision 3bdc451802 (2 hours ago), 2024-06-13 18:06:17 -0400
    • Engine revision 8167dffd19
    • Dart version 3.5.0 (build 3.5.0-254.0.dev)
    • DevTools version 2.36.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /usr/local/home/username/Android/Sdk
    • Platform android-34, build-tools 33.0.1
    • ANDROID_HOME = /usr/local/home/username/Android/Sdk
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+7-Debian-1)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Debian clang version 16.0.6 (20)
    • cmake version 3.28.3
    • ninja version 1.11.1
    • pkg-config version 1.8.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Debian GNU/Linux rodete 6.6.15-2rodete2-amd64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 126.0.6478.61

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

from flutter.

fernandooliiveira avatar fernandooliiveira commented on July 21, 2024

@gspencergoog I tested this on a different computer and another Linux distribution, but the error still occurs.

Doctor output
[✓] Flutter (Channel stable, 3.22.2, on Linux Mint 21.1 5.15.0-75-generic,
    locale en_US.UTF-8)
    • Flutter version 3.22.2 on channel stable at /home/fernando/apps/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (9 days ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/fernando/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/fernando/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1.1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2022.2)
    • Android Studio at /home/fernando/apps/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1)
    • IntelliJ at /home/fernando/apps/idea
    • Flutter plugin version 80.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Linux Mint 21.1
      5.15.0-75-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 120.0.6099.129

[✓] Network resources
    • All expected network resources are available.

• No issues found!
Video demonstration 2
focusable_action_detector.mp4

from flutter.

LimaneGaya avatar LimaneGaya commented on July 21, 2024

I'm not sure if this is related but also on web, using the 'Find in Page' shortcut (Ctrl + F) or 'Print' (Ctrl + P) causes the application to become unresponsive to defined shortcuts.

from flutter.

gspencergoog avatar gspencergoog commented on July 21, 2024

It seems that the issue is fixed on the main channel. Can you try main and see if it fixes the issue for you?

To switch to main channel:

flutter channel main

If it does, then the issue is fixed already, and will be in the next stable release.

from flutter.

gspencergoog avatar gspencergoog commented on July 21, 2024

I'm not sure if this is related but also on web, using the 'Find in Page' shortcut (Ctrl + F) or 'Print' (Ctrl + P) causes the application to become unresponsive to defined shortcuts.

No, this is not related. That has to do with refocusing the page after losing focus to the browser UI, and I'm pretty sure that is working as intended. The user has to click into the page again to refocus the app. If you think it's an issue, please file a separate issue (it's off topic for this issue).

from flutter.

fernandooliiveira avatar fernandooliiveira commented on July 21, 2024

@gspencergoog I switched to the main channel, but it still does not recognize the keyboard event.

Could it be something related to the distribution I am using? In the examples I sent, I used Ubuntu and LinuxMint, but I can try another one if necessary.

Doctor output
[✓] Flutter (Channel main, 3.23.0-13.0.pre.236, on Ubuntu 24.04 LTS
    6.8.0-35-generic, locale en_US.UTF-8)
    • Flutter version 3.23.0-13.0.pre.236 on channel main at
      /home/fernando-dev/apps/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision be94ed8bdf (27 minutes ago), 2024-06-14 11:55:20 -0400
    • Engine revision 8167dffd19
    • Dart version 3.5.0 (build 3.5.0-254.0.dev)
    • DevTools version 2.36.0

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/fernando-dev/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/fernando-dev/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 18.1.3 (1)
    • cmake version 3.28.3
    • ninja version 1.11.1
    • pkg-config version 1.8.1

[✓] Android Studio (version 2023.3)
    • Android Studio at /home/fernando-dev/apps/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1)
    • IntelliJ at /home/fernando-dev/apps/intellij
    • Flutter plugin version 80.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 24.04 LTS
      6.8.0-35-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 125.0.6422.141

[✓] Network resources
    • All expected network resources are available.

• No issues found!
Video in main channel
simplescreenrecorder-2024-06-14_13.35.42.mp4

from flutter.

gspencergoog avatar gspencergoog commented on July 21, 2024

Hmm. I doubt it's the distribution, it seems pretty specific (I would expect to see all keys stop working or something), but it's possible, I suppose. Those are both pretty common distributions, so probably this would have been noticed by others if it were the distro.

Has it ever worked for you, with previous versions? If so, finding which version of Flutter broke it would be helpful.

What keyboard layout are you using? And does it match your locale?

from flutter.

fernandooliiveira avatar fernandooliiveira commented on July 21, 2024

@gspencergoog Yes, I tested FocusableActionDetector on Linux back in September 2023, which I confirmed by checking my commits. For context, in October 2023, we got our first clients for our system. They used only Windows, so we stopped testing on Linux until our first Linux client came along. When I was setting up new configurations, I noticed the shortcuts weren't working. I used Ubuntu (either 20 or 22). According to my research, the stable version of Flutter at that time was 3.13, which I was likely using. I'll reinstall 3.13 and test it.

For the keyboard, I use Portuguese, Brazil (Generic 105-key PC), and the locale is en_US.

from flutter.

gspencergoog avatar gspencergoog commented on July 21, 2024

The difference in keyboard layout vs locale shouldn't be the issue (since the Portuguese has a and b in the same place as US English).

If it did work on 3.13, you can maybe use git bisect and find out when it started. That's what I would do if I could reproduce it.

from flutter.

fernandooliiveira avatar fernandooliiveira commented on July 21, 2024

@gspencergoog Finally, I found the version when it started.

After testing different versions, the issue first appeared in version 3.16.9.

Flutter 3.16.8

Video demonstration
flutter_3_16_8.mp4
Doctor output 3.16.8
[✓] Flutter (Channel stable, 3.16.8, on Ubuntu 24.04 LTS 6.8.0-35-generic,
    locale en_US.UTF-8)
    • Flutter version 3.16.8 on channel stable at
      /home/fernando-dev/apps/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 67457e669f (5 months ago), 2024-01-16 16:22:29 -0800
    • Engine revision 6e2ea58a5c
    • Dart version 3.2.5
    • DevTools version 2.28.5

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/fernando-dev/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/fernando-dev/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 18.1.3 (1)
    • cmake version 3.28.3
    • ninja version 1.11.1
    • pkg-config version 1.8.1

[✓] Android Studio (version 2023.3)
    • Android Studio at /home/fernando-dev/apps/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1)
    • IntelliJ at /home/fernando-dev/apps/intellij
    • Flutter plugin version 80.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 24.04 LTS
      6.8.0-35-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 125.0.6422.141

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Flutter 3.16.9

Video demonstration
flutter_3_16_9_error.mp4
Doctor output 3.16.9
[✓] Flutter (Channel stable, 3.16.9, on Ubuntu 24.04 LTS 6.8.0-35-generic,
    locale en_US.UTF-8)
    • Flutter version 3.16.9 on channel stable at
      /home/fernando-dev/apps/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 41456452f2 (5 months ago), 2024-01-25 10:06:23 -0800
    • Engine revision f40e976bed
    • Dart version 3.2.6
    • DevTools version 2.28.5

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/fernando-dev/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /home/fernando-dev/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 18.1.3 (1)
    • cmake version 3.28.3
    • ninja version 1.11.1
    • pkg-config version 1.8.1

[✓] Android Studio (version 2023.3)
    • Android Studio at /home/fernando-dev/apps/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1)
    • IntelliJ at /home/fernando-dev/apps/intellij
    • Flutter plugin version 80.0.2
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Ubuntu 24.04 LTS
      6.8.0-35-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 125.0.6422.141

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Commits 3.16.9
image

dart-lang/sdk#54699

from flutter.

gspencergoog avatar gspencergoog commented on July 21, 2024

To me, that cherry pick seems unlikely to have caused this issue, but I guess if you can repro it there, then it somehow is.
The Dart team will need to look into why, since this appears to be lower down than the Framework.

@a-siva, can you think of any reason that the cherrypick would have an effect like this on Linux? I'm unable to reproduce this on Linux, but @fernandooliiveira can, and has bisected it to the Dart cherrypick in dart-lang/sdk#54699 . (I realize that without being able to reproduce it, it will be hard to track down.)

from flutter.

a-siva avatar a-siva commented on July 21, 2024

@a-siva, can you think of any reason that the cherrypick would have an effect like this on Linux? I'm unable to reproduce this on Linux, but @fernandooliiveira can, and has bisected it to the Dart cherrypick in dart-lang/sdk#54699 . (I realize that without being able to reproduce it, it will be hard to track down.)

That change was mainly in the debugger code and should come into play only when the flutter app is being debugged so it is kind of surprising that it seems to have an impact on actual functionality @fernandooliiveira are you able to reproduce the problem on an AOT build of the application too ?

from flutter.

fernandooliiveira avatar fernandooliiveira commented on July 21, 2024

@a-siva @gspencergoog I apologize for my previous message. I made a mistake while trying to find the version where the issue occurred. It was not in version 3.16.9, but actually in version 3.19.0.

Testing an AOT build made me realize the mistake I had made. I'm truly sorry for any confusion this may have caused.

The issue indeed started in version 3.19.0. According to the commits, there is no specific flag indicating a change for Linux, but there are some changes related to keyboards specific to Windows and macOS.

Video demonstration 3.19.0
flutter_3_19.mp4
Video demonstration 3.16.9 (No Issues)
flutter_3_16_9.mp4

from flutter.

fernandooliiveira avatar fernandooliiveira commented on July 21, 2024

I found a solution that works with the latest versions. It involves removing the FocusableActionDetector and using HardwareKeyboard instead.

Code sample
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  void _decrementCounter() {
    setState(() {
      _counter--;
    });
  }

  bool _handleKeyEvent(KeyEvent event) {
    if (event is KeyDownEvent) {
      if (event.logicalKey == LogicalKeyboardKey.keyA &&
          HardwareKeyboard.instance.logicalKeysPressed.contains(LogicalKeyboardKey.controlLeft)) {
        _incrementCounter();
        return true;
      }
      if (event.logicalKey == LogicalKeyboardKey.keyB &&
          HardwareKeyboard.instance.logicalKeysPressed.contains(LogicalKeyboardKey.controlLeft)) {
        _decrementCounter();
        return true;
      }
    }
    return false;
  }

  @override
  void initState() {
    HardwareKeyboard.instance.addHandler(_handleKeyEvent);
    super.initState();
  }

  @override
  void dispose() {
    HardwareKeyboard.instance.removeHandler(_handleKeyEvent);
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme
            .of(context)
            .colorScheme
            .inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme
                  .of(context)
                  .textTheme
                  .headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

from flutter.

fernandooliiveira avatar fernandooliiveira commented on July 21, 2024

@gspencergoog I tested your example, and using the Focus widget to capture keyboard events works just as well as the FocusableActionDetector. Thanks a lot for your help!

from flutter.

gspencergoog avatar gspencergoog commented on July 21, 2024

@fernandooliiveira But wasn't the FocusableActionDetector not working for you? Are you saying that both Focus and the FocusableActionDetector now work for you? Or just Focus? (it would be odd if one worked and the other didn't considering that the FocusableActionDetector uses Focus to do its work).

from flutter.

fernandooliiveira avatar fernandooliiveira commented on July 21, 2024

@gspencergoog The FocusableActionDetector dont trigger events on Linux. From my tests, it seems like something changed in version 3.19.0. But Focus or FocusScope are working perfectly, and I can capture all the events on Linux/Windows.

from flutter.

gspencergoog avatar gspencergoog commented on July 21, 2024

Okay, that is odd. I can successfully run your original code snippet on Linux (as I said above). If Focus and HardwareKeyboard both work, then it doesn't have to do with the key event system, which is what I would suspect in a case where it works on some versions of Linux and not others. The rest of the code in FocusableActionDetector has to do with actions and shortcuts, and should be entirely platform (and especially platform version) independent. The only thing that might be affecting things is that in the FocusableActionDetector, it wraps the Focus with a MouseRegion.

I'm going to leave this open to see if others have a similar problem so that we can collect more data to start to narrow it down, but I don't know what else I can do from here to proceed.

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.