-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#52495Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowIt was better in the past than it is nowf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.19Found to occur in 3.19Found to occur in 3.19found in release: 3.20Found to occur in 3.20Found to occur in 3.20frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-macBuilding on or for macOS specificallyBuilding on or for macOS specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to reproduce
Using a RawKeyboardListener.onKey that wraps a TextField, to close a Dialog using Navigator.pop.
Notice: Could not be reproduced on Windows, but reproduced on multiple MacOS devices. Cannot be reproduced on stable, only on beta (both 3.18 and 3.19)
Expected results
TextFields can receive and act on input normally.
Actual results
All TextFields are broken and can no longer function properly, eg. backspace doesn't work.
Code sample
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(
home: const Home(),
theme: ThemeData.light(useMaterial3: true),
);
}
}
class Home extends StatefulWidget {
const Home({super.key});
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
String val = 'Hello World';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('TextField breaks')),
body: Column(
children: [
Text('Value: $val'),
TextButton(
onPressed: () => showDialog(
context: context,
builder: (context) => ADialog(
value: val,
),
).then((v) {
if (mounted && v != null && v != val) {
setState(() => val = v);
}
}),
child: const Text('Change'),
),
const TextField(),
],
),
);
}
}
class ADialog extends StatefulWidget {
const ADialog({super.key, required this.value});
final String value;
@override
State<ADialog> createState() => ADialogState();
}
class ADialogState extends State<ADialog> {
final focusNode = FocusNode();
late final controller = TextEditingController(text: widget.value);
@override
void dispose() {
focusNode.dispose();
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Edit text'),
content: RawKeyboardListener(
focusNode: focusNode,
onKey: (event) {
if (event is! RawKeyDownEvent) return;
if (event.logicalKey == LogicalKeyboardKey.escape) {
Navigator.of(context).pop();
}
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextField(
controller: controller,
autofocus: true,
),
TextButton(
onPressed: () => Navigator.of(context).pop(controller.text),
child: const Text('Save'),
)
],
),
),
);
}
}Screenshots or Video
Screenshots / Video demonstration
c6c9ef75-0279-4b25-a987-524b9de79a1e.mp4
Logs
Nothing at all in the logs.
Flutter Doctor output
Doctor output
[✓] Flutter (Channel beta, 3.19.0-0.4.pre, on macOS 14.2 23C64 darwin-arm64,
locale en-DK)
• Flutter version 3.19.0-0.4.pre on channel beta at
/Users/mathias/Development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b7e7d46a04 (8 days ago), 2024-02-02 08:21:06 -0600
• Engine revision 98820f0a77
• Dart version 3.3.0 (build 3.3.0-279.3.beta)
• DevTools version 2.31.0
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/mathias/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C65
• CocoaPods version 1.14.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.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
17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.85.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.82.0
[✓] Connected device (4 available)
• Super iPhone (mobile) • 00008110-00123CD634D9401E • ios
• iOS 17.2.1 21C66
• iPhone 15 Pro (mobile) • 4DE2390A-F63A-4355-AB41-51C0E40E4913 • ios
• com.apple.CoreSimulator.SimRuntime.iOS-17-2 (simulator)
• macOS (desktop) • macos •
darwin-arm64 • macOS 14.2 23C64 darwin-arm64
• Chrome (web) • chrome •
web-javascript • Google Chrome 121.0.6167.160
[✓] Network resources
• All expected network resources are available.
• No issues found!Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowIt was better in the past than it is nowf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 3.19Found to occur in 3.19Found to occur in 3.19found in release: 3.20Found to occur in 3.20Found to occur in 3.20frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onplatform-macBuilding on or for macOS specificallyBuilding on or for macOS specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team