Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同一个页面两个输入框切换输入报错 #82

Open
Xmaoyh opened this issue Jun 22, 2022 · 4 comments
Open

同一个页面两个输入框切换输入报错 #82

Xmaoyh opened this issue Jun 22, 2022 · 4 comments

Comments

@Xmaoyh
Copy link

Xmaoyh commented Jun 22, 2022

`======== Exception caught by gesture ===============================================================
The following assertion was thrown while handling a gesture:
A KeyboardController was used after being disposed.

Once you have called dispose() on a KeyboardController, it can no longer be used.
When the exception was thrown, this was the stack:
#0 ChangeNotifier._debugAssertNotDisposed. (package:flutter/src/foundation/change_notifier.dart:114:9)
#1 ChangeNotifier._debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:120:6)
#2 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:288:12)
#3 ValueNotifier.value= (package:flutter/src/foundation/change_notifier.dart:412:5)
#4 KeyboardController.value= (package:cool_ui/keyboards/keyboard_controller.dart:50:11)
#5 KeyboardController.addText (package:cool_ui/keyboards/keyboard_controller.dart:107:5)`

输入完一个再点击另一个输入时,报错。

@Xmaoyh
Copy link
Author

Xmaoyh commented Jun 22, 2022

一种解决方法是注册两个键盘,每个输入框一个

@Im-Kevin
Copy link
Owner

这两个是同一个键盘吗

@Xmaoyh
Copy link
Author

Xmaoyh commented Jun 23, 2022

这两个是同一个键盘吗

是的

@jianchao97
Copy link

Hi,

I encounter the same error when I convert my keyboard become Stateful Widget and assign the keyboard controller to a late variable.
image

However, I am able to resolve the error if I remove the late variable and directly use the widget.controller.
image

I'm not sure what is the root cause and why the error was gone after removing the late variable. Maybe you can try to do the same thing to eliminate the error.

Please also share me if you found the reason or root cause.

Thankss!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants