Repository navigation
Open
Labels
P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsc: performanceRelates to speed or footprint issues (see "perf:" labels)found in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onperf: speedPerformance issues related to (mostly rendering) speedteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team
Description
For example, this app:
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
void main() {
final TextEditingController controller = TextEditingController();
runApp(
MaterialApp(
home: Material(
child: Center(
child: Column(
children: [
TextField(controller: controller),
TextButton(
onPressed: () {
controller.text = 'abcdef' * 100000;
},
child: Text('Fill'),
),
],
),
),
),
),
);
}on my MacBook pro causes the app to freeze after pressing fill. I discovered this when accidentally pasting a very large amount of text into a text field while testing something else. In that case, the text field probably also had some extra styling and input formatters, and the app completely hung (and hot restarting caused it to crash). This sample app does not crash on hot restart, but I suspect adding formatters or making the text even larger might cause it to.
Reacted by Ricardo Canastro, Pablo Jiménez Pascual, Sasha Isaienko, fabiancrx, Faisal Arshed, Kabo, Dan Syrstad, Marcel Čampa, Greg Price, Naga and 15 more
Reacted by Bernardo Ferrari, -, Pablo Jiménez Pascual, Shinichi Katayama, Faisal Arshed and Naga
Reacted by Faisal Arshed, Naga and Yang Lin
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsc: performanceRelates to speed or footprint issues (see "perf:" labels)found in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onperf: speedPerformance issues related to (mostly rendering) speedteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team
Activity
goderbauer commentedon Sep 15, 2021
/cc @justinmc
maheshj01 commentedon Sep 22, 2021
I am able to reproduce the issue on m1 mac the app is almost frozen, verified on
stable 2.5.1andmaster 2.6.0-6.0.pre.171. I could not reproduce the crash (on hot restart) after addingstyle.code sample
flutter doctor -v
on a side note: adding
maxlinesto textfield it takes much longer (around 10s or more) to fill text into textfied.justinmc commentedon Sep 23, 2021
Thanks for the reproducible issue, this has been in the back of my mind for awhile. I want to figure out exactly what the bottleneck is here. Just some quick thoughts for now:
cbracken commentedon Oct 18, 2021
flutter-team-archive/engine#29036 may help for macOS.
charmoan commentedon Oct 22, 2021
charmoan commentedon Oct 22, 2021
33 remaining items
Justus-M commentedon Dec 2, 2023
Any updates or workarounds?
Srimathi622 commentedon Dec 7, 2023
is there any document available for creating our own TextField using DeltaTextInputClient? I am facing a performance issue. The speed is reduced when we have a huge record
MegatronKing commentedon Dec 7, 2023
In my opinion, TextField is suitable for small input text, such as account, password. For the large text, a specific
Widgetis required.I wrote a code editor for the Reqable project, which basically solved this issue, I can provide some ideas.
SingleChildRenderObjectWidgetto take over layout and drawing, rather thanTextField.video.mp4
However, there is still a problem, when the single line of text is too large, the layout will cause lag. I tested
VS Codeand there was no such issue, this seems to be a performance issue from graphics engine.dtruong27 commentedon Dec 7, 2023
We had a workaround but only for the Web platform. We wanted to use a
TextAreaElementbut there is a bug thatonKeyUpandonKeyDownevents are not triggered. We then ended up usingIFrameElementwith<textarea>in thesrcdoc. Our workaround looks like this:Srimathi622 commentedon Dec 7, 2023
Thanks for your replies. Is there any workaround for the desktop application (Windows and macOS)? I need a code editor to handle huge text.
MegatronKing commentedon Feb 5, 2024
Try this one: https://pub.dev/packages/re_editor
Srimathi622 commentedon Mar 12, 2024
Thanks a lot. It works
Markaleth commentedon May 5, 2024
Just to add to the discussion., this issue also happens with plain Text or SelectableText widgets. Or at least, my assumption is that it's the same root cause at play.
My current use case is trying to render a very large JSON response to the UI in a SelectableText widget with flutter web. The length of the string i'm passing to the SelectableText / Text widget is between 270k and 870k characters.
This results in the website hanging for anywhere between 250 ms to close to 1000 ms.
Maruf-Elsa commentedon Dec 12, 2024
I had the same issue when validating email. The reason was Flutter was not able to handle complex regex and was hanging the app when the email was more than 35 characters. I hope the Flutter team takes a note of this and fixes it.
Complex regex hanging the app -
r'^[_A-Za-z0-9-+]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*(\.[A-Za-z]{2,})$'Simple working regex for email-
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'heckmon commentedon Jan 17, 2026
@Srimathi622
Have a look at this one: https://github.com/heckmon/code_forge
Srimathi622 commentedon Feb 26, 2026
Sure, Heckmon, I will do. It seems interesting. Thanks for sharing it
[skparagraph] Keep line breaking of long words linear