简体   繁体   English

轻敲 FLUTTER TEXTFIELD 会破坏应用程序

[英]TAPPING FLUTTER TEXTFIELD CRUSHES THE APP

here's a video which shows my problem.这是一个显示我的问题的视频。

https://drive.google.com/file/d/1YTnu1amCYhN9CGLygAyag-LhYMn3BDiO/view?usp=sharing https://drive.google.com/file/d/1YTnu1amCYhN9CGLygAyag-LhYMn3BDiO/view?usp=sharing

Thing is, I'm developing an app in flutter and have been debugging it for several months already in a real hardware (my own phone with android 11).问题是,我正在 flutter 中开发一个应用程序,并且已经在真实硬件中调试了几个月(我自己的手机带有 android 11)。 Suddenly, today I have experienced this error.突然,今天我遇到了这个错误。 When I tap on a textfield or textformfield, the app crushes and restarts automatically.当我点击文本字段或文本表单字段时,应用程序会自动崩溃并重新启动。 I've researched a couple forums which suggest:我研究了几个论坛,这些论坛建议:

But it doesn't work for me.但这对我不起作用。

I've already been several hours trying to figure this out, rebooting my pc, my phone, trying an emulator, a friend's phone instead of mine, changing the properties of the textfields... But nothing seems to work.我已经花了几个小时试图解决这个问题,重新启动我的电脑,我的手机,尝试一个模拟器,一个朋友的手机而不是我的手机,改变文本字段的属性......但似乎没有任何效果。 I've read that this problem happens randomly at some android 11 devices, but have seen no solution to it (I don't even know if there exists one).我读过这个问题在一些 android 11 设备上随机发生,但没有看到解决方案(我什至不知道是否存在)。

About my code, it's as simple as this:关于我的代码,就这么简单:

                  Flexible(
                    child: FractionallySizedBox(
                      widthFactor: 0.75,
                      heightFactor: 0.75,
                      alignment: Alignment.centerLeft,
                      child: TextFormField(
                        decoration: InputDecoration(
                          icon: Icon(Icons.person),
                          fillColor: Colors.white.withOpacity(0.80),
                          filled: true,
                        ),
                        onChanged: (String v) => nombre = v,
                        textInputAction: TextInputAction.go,
                      ),
                    ),
                  ),

My pubspec dependencies are:我的 pubspec 依赖项是:

firebase_core: ^1.17.1
firebase_auth: ^3.3.19
firebase_database: ^9.0.15
firebase_messaging: ^11.4.1
firebase_storage: ^10.2.17
event: ^2.0.5
mutex: ^3.0.0
chat_bubbles: ^1.3.0
clipboard: ^0.1.3
image_picker: ^0.8.5+3
shared_preferences: ^2.0.15
path_provider: ^2.0.11
xdg_directories: ^0.2.0
flutter_tts: ^3.4.0
google_speech: ^2.1.1
speech_to_text: ^5.6.0
record: ^4.1.1
gcloud: ^0.8.5
flutter_local_notifications: ^9.6.0
http: ^0.13.4
crypto: ^3.0.2
semaphore: ^0.2.1
audioplayers: ^1.0.0
spring_button: ^2.0.0
google_fonts: ^3.0.1
flutter_app_name: ^0.1.1  

As I said, it has delivered no problems for the last months.正如我所说,它在过去几个月中没有出现任何问题。

If anyone has an idea that may make it work again, I would be very grateful.如果有人有一个可以让它再次发挥作用的想法,我将不胜感激。 And if want more data of my project, just ask for it.如果想要我项目的更多数据,请索取。 Thank you very much in advance.非常感谢您提前。

Three weeks since this problem appeared, I have at last discovered where the error was all along.自从这个问题出现三周后,我终于发现了错误一直在哪里。 It seems I had a window in the Navigator pile that was a Stateless Widget instead of a Stateful Widget, and when that happens, every time a reload happens (hot reload, textfield tapping, launching the keyboard, etc), provokes that the application restarts.似乎我在 Navigator 堆中有一个 window,它是一个无状态小部件而不是有状态小部件,当这种情况发生时,每次重新加载(热重载、文本字段点击、启动键盘等)时,都会引发应用程序重新启动. It seems logical, actually, but I didn't think about that window at all, so I just popped it from the Navigator as soon as I finished with it and everything went just fine.实际上,这似乎是合乎逻辑的,但我根本没有想到 window,所以我一完成它就从导航器中弹出它,一切都很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在Webview应用中点击文本框不会显示软键盘 - Tapping textfield in webview app does not show soft keyboard 在 Flutter 中点击 TimePicker 上的“完成”后,如何更新 TextField 的文本? - How can I update a TextField's text after tapping on "Done" on a TimePicker in Flutter? 如何通过点击图像或卡片在带有 flutter 的应用程序中打开任何 URL? - How to open any URL inside an app with flutter by tapping on image or card? 我的第一个 Flutter 应用程序构建中的文本字段问题 - Problem with textfield in my first Flutter app build 数据库处理程序出现问题会破坏应用程序 (kotlin) - Having problem with database handler crushes the app (kotlin) AutocompleteSupportFragment.setPlaceFields 在启动时粉碎应用程序 - AutocompleteSupportFragment.setPlaceFields crushes App on start 如何通过点击 Flutter 应用程序中的按钮,使用默认应用程序打开 PPT、PDF、文档等? - How to open PPTs, PDFs, docs, etc. using default applicaitions by tapping on a button in a Flutter app? 在 TextField 中键入 dot(.) 时,Flutter Android 应用程序挂起 - Flutter Android App hangs, while typing dot(.) in TextField 当我在手机上运行它进行测试时,我的应用程序崩溃了 - My app crushes when i run it on my phone to test it 来自外部存储android的txt文件传输。 应用粉碎 - txt file transmission from external storage android. App Crushes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM