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

自定义的键盘按返回键时会促发TextField onSubmitted #28

Closed
zhangtengchao opened this issue Aug 26, 2019 · 3 comments
Closed

Comments

@zhangtengchao
Copy link

zhangtengchao commented Aug 26, 2019

如题,在你的Demo例子上,
TextField( decoration: InputDecoration(labelText: '演示键盘弹出后滚动'), keyboardType: NumberKeyboard.inputType, onSubmitted: (txt){ print('aaaaaaaa'); }, ), TextField( decoration: InputDecoration(labelText: '多个键盘演示'), keyboardType: TestKeyboard.inputType, onSubmitted: (txt){ print('bbbbbbb'); }, )
加上onSubmitted,当键盘弹出时,按返回键,就会自动促发onSubmitted

@Im-Kevin
Copy link
Owner

这个是flutter自带的效果

@science168
Copy link

如上面所提到的, onSubmitted问题. 安卓物理返回键会触犯onSubmitted. 但跟踪代码好像是内部处理物理返回键
// BackButtonInterceptor.add((_) { // CoolKeyboard.sendPerformAction(TextInputAction.done); // return true; // }, zIndex: 1, name: 'CustomKeyboard'); } // BackButtonInterceptor.removeByName('CustomKeyboard');

@Im-Kevin
Copy link
Owner

Im-Kevin commented Jul 3, 2020

是的,这个是模仿原生键盘的操作

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