-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Steps to Reproduce
When pressing physical keyboard keys HOME or END in a TextField on platform Windows, the cursor does not move anywhere.
Consider this example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Text Edit',
home: _TextFieldExample(),
);
}
}
class _TextFieldExample extends StatefulWidget {
@override
_TextFieldExampleState createState() => _TextFieldExampleState();
}
class _TextFieldExampleState extends State<_TextFieldExample> {
final FocusNode _focusNode = FocusNode();
final TextEditingController _textController = TextEditingController();
@override
void dispose() {
_focusNode.dispose();
_textController.dispose();
super.dispose();
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Text Test'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 400,
child: TextField(
controller: _textController,
focusNode: _focusNode,
decoration: InputDecoration(
hintText: 'Write something, then press HOME and END key',
border: const OutlineInputBorder(),
),
),
),
],
),
),
);
}
}Expected results
- HOME pressed -> Expect: Cursor moves to first char position when there is some text in the field.
- END pressed -> Expect: Cursor moves to last char position when there is some text in the field.
Actual results
- HOME pressed -> Actual: Cursor does not move anywhere.
- END pressed -> Actual: Cursor does not move anywhere.
Tested on
Platform WINDOWS
Channel master, 1.27.0-2.0.pre.103 : FAIL
Channel dev, 1.27.0-1.0.pre : FAIL
Platform WEB
Channel master, 1.27.0-2.0.pre.103 : OK
Channel dev, 1.27.0-1.0.pre : OK
Channel beta, 1.26.0-17.5.pre: OK
Works OK on Web, but FAILS on Windows.
This issue should also be tested on platforms macOS and Linux to ensure it does not appear on them as well.
EDIT:
Based on Twitter feedback it works OK on macOS: https://twitter.com/tomgilder/status/1361730262791557121?s=20
Disclaimer
Platform Windows is not ready and only on dev channel (alpha), but as it moves closer to being more ready, issues like these will eventually need to be resolved.
Flutter DOCTOR
[√] Flutter (Channel master, 1.27.0-2.0.pre.103, on Microsoft Windows [Version 10.0.19041.804], locale en-US)
• Flutter version 1.27.0-2.0.pre.103 at C:\Users\mryds\fvm\versions\master
• Framework revision f49956598b (10 hours ago), 2021-02-16 00:56:06 -0500
• Engine revision 1d537824d6
• Dart version 2.13.0 (build 2.13.0-30.0.dev)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\mryds\AppData\Local\Android\sdk
• Platform android-30, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.8.3)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.8.30804.86
• Windows 10 SDK version 10.0.18362.0
[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\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 1.8.0_242-release-1644-b01)
[√] IntelliJ IDEA Community Edition (version 2020.3)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.3.1
• Flutter plugin version 53.1.5
• Dart plugin version 203.6912
[√] VS Code (version 1.53.2)
• VS Code at C:\Users\mryds\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.19.0
[√] Connected device (5 available)
• Nexus 7 (mobile) • 0a99f5e8 • android-arm • Android 6.0.1 (API 23)
• SM T510 (mobile) • R52N906MLAV • android-arm • Android 10 (API 29)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19041.804]
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.150
• Edge (web) • edge • web-javascript • Microsoft Edge 88.0.705.68
• No issues found!