Skip to content

RawKeyboardListener & Focus onKey callback doesn't working on IOS (reproduce on Iphone 6 & Iphone13 pro) #108210

@SungHyun22

Description

@SungHyun22

onKey Callback from RawKeyboardListener and Focus Widget not working on iphone6 & Iphone 13 pro. But in the simulator it works fine. Only Iphone6 & Iphone13 pro ​​reproduces this problem.

Steps to Reproduce

try run this code on Iphone6 & Iphone13 pro

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'RawKeyboardListener onKey error',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

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

class _MyHomePageState extends State<MyHomePage> {
  late FocusNode _focusNode;

  @override
  void initState() {
    super.initState();
    _focusNode = FocusNode();
  }

  @override
  void dispose() {
    _focusNode.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("RawKeybaordListener onKey error"),
      ),
      body: RawKeyboardListener(
        focusNode: _focusNode,
        onKey: (event) {
          // doesn't working
          print(event);
        },
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: const <Widget>[
              TextField(),
            ],
          ),
        ),
      ),
    );
  }
}

flutter doctor

[✓] Flutter (Channel stable, 3.0.5, on macOS 12.4 21F79 darwin-arm, locale
ko-KR)
• Flutter version 3.0.5
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d5 (9 days ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK
• Platform android-31, build-tools 30.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• 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 11.0.10+0-b96-7249189)
[✓] VS Code (version 1.69.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.44.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemse: device-specificOnly manifests on certain devicesfound in release: 3.0Found to occur in 3.0found in release: 3.1Found to occur in 3.1has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: solvedIssue is closed as solvedteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform teamwaiting for customer responseThe Flutter team cannot make further progress on this issue until the original reporter responds

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions