You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tap to move cursor in textfield not working on android #100004
This only seems to happen on physical devices. So far it has occurred with the s8 and the s10. Unsure if the issue can be reproduced elsewhere, but it does not occur in ios simulator, physical ios, or android emulator.
Create a TextField widget and type something in it
Tap somewhere in the middle of the text you just typed, with the intention of moving the cursor to where you tapped
Expected results:
Cursor moves to the location that was tapped Actual results:
The text between where you tapped and the last character in the textfield gets selected (highlighted).
Because of this issue it's very difficult for a user to go back and fix typos and such.
Hi @Fnalsk, I am unable to reproduce the issue on ios or Android on the latest stable channel of flutter 2.10.3. Please share the output of flutter doctor -v.
This example isn't necessarily minimal in the sense of smallest number of lines of code. But the following was created by simply opening a new flutter project in Intellij and adding a TextField(),.
Typing in that textfield and attempting to move the cursor on a physical galaxy s10 device results in the issue outlined above occurring.
code sample
import'package:flutter/material.dart';
voidmain() {
runApp(constMyApp());
}
classMyAppextendsStatelessWidget {
constMyApp({Key? key}) :super(key: key);
// This widget is the root of your application.@overrideWidgetbuild(BuildContext context) {
returnMaterialApp(
title:'Flutter Demo',
theme:ThemeData(
// This is the theme of your application.//// Try running your application with "flutter run". You'll see the// application has a blue toolbar. Then, without quitting the app, try// changing the primarySwatch below to Colors.green and then invoke// "hot reload" (press "r" in the console where you ran "flutter run",// or simply save your changes to "hot reload" in a Flutter IDE).// Notice that the counter didn't reset back to zero; the application// is not restarted.
primarySwatch:Colors.blue,
),
home:constMyHomePage(title:'Flutter Demo Home Page'),
);
}
}
classMyHomePageextendsStatefulWidget {
constMyHomePage({Key? key, requiredthis.title}) :super(key: key);
// This widget is the home page of your application. It is stateful, meaning// that it has a State object (defined below) that contains fields that affect// how it looks.// This class is the configuration for the state. It holds the values (in this// case the title) provided by the parent (in this case the App widget) and// used by the build method of the State. Fields in a Widget subclass are// always marked "final".finalString title;
@overrideState<MyHomePage> createState() =>_MyHomePageState();
}
class_MyHomePageStateextendsState<MyHomePage> {
int _counter =0;
void_incrementCounter() {
setState(() {
// This call to setState tells the Flutter framework that something has// changed in this State, which causes it to rerun the build method below// so that the display can reflect the updated values. If we changed// _counter without calling setState(), then the build method would not be// called again, and so nothing would appear to happen.
_counter++;
});
}
@overrideWidgetbuild(BuildContext context) {
// This method is rerun every time setState is called, for instance as done// by the _incrementCounter method above.//// The Flutter framework has been optimized to make rerunning build methods// fast, so that you can just rebuild anything that needs updating rather// than having to individually change instances of widgets.returnScaffold(
appBar:AppBar(
// Here we take the value from the MyHomePage object that was created by// the App.build method, and use it to set our appbar title.
title:Text(widget.title),
),
body:Center(
// Center is a layout widget. It takes a single child and positions it// in the middle of the parent.
child:Column(
// Column is also a layout widget. It takes a list of children and// arranges them vertically. By default, it sizes itself to fit its// children horizontally, and tries to be as tall as its parent.//// Invoke "debug painting" (press "p" in the console, choose the// "Toggle Debug Paint" action from the Flutter Inspector in Android// Studio, or the "Toggle Debug Paint" command in Visual Studio Code)// to see the wireframe for each widget.//// Column has various properties to control how it sizes itself and// how it positions its children. Here we use mainAxisAlignment to// center the children vertically; the main axis here is the vertical// axis because Columns are vertical (the cross axis would be// horizontal).
mainAxisAlignment:MainAxisAlignment.center,
children:<Widget>[
constText(
'You have pushed the button this many times:',
),
TextField(),
Text(
'$_counter',
style:Theme.of(context).textTheme.headline4,
),
],
),
),
floatingActionButton:FloatingActionButton(
onPressed: _incrementCounter,
tooltip:'Increment',
child:constIcon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
There is a similar issue describing this case #98720, Please follow up there for further updates, Closing this issue as a duplicate. If you disagree feel free to write in the comments and we will reopen it.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
maheshj01 commentedon Mar 14, 2022
Hi @Fnalsk, I am unable to reproduce the issue on ios or Android on the latest stable channel of
flutter 2.10.3. Please share the output offlutter doctor -v.Fnalsk commentedon Mar 15, 2022
maheshj01 commentedon Mar 15, 2022
@Fnalsk Please share the minimal reproducible code sample. I am unable to reproduce this issue with the below code sample.
code sample
flutter doctor -v (mac)
maheshj01 commentedon Mar 16, 2022
Please also check if this is related #81013 ?
Fnalsk commentedon Mar 16, 2022
This example isn't necessarily minimal in the sense of smallest number of lines of code. But the following was created by simply opening a new flutter project in Intellij and adding a
TextField(),.Typing in that textfield and attempting to move the cursor on a physical galaxy s10 device results in the issue outlined above occurring.
code sample
maheshj01 commentedon Mar 16, 2022
Thanks for the update @Fnalsk,
There is a similar issue describing this case #98720, Please follow up there for further updates, Closing this issue as a duplicate. If you disagree feel free to write in the comments and we will reopen it.
Thank you.
Fnalsk commentedon Mar 17, 2022
That issue seems to only arise when there are two exclamation points at the end of the string? This one arises regardless of what the string is.
The two are admittedly similar, but I wouldn't be confident in saying that fixing #98720 will also fix this.
github-actions commentedon Mar 31, 2022
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.