Im-Kevin / cool_ui

用flutter实现一些我认为好看的UI控件,有Popover,仿Weui的Toast,自定义键盘
Apache License 2.0
460 stars 74 forks source link

内置键盘与自定义键盘如何进行切换? #88

Open ddxl123 opened 1 year ago

Im-Kevin commented 1 year ago

这个是已经封装好的,只需要设置正确的InputType就行了

ddxl123 commented 1 year ago

这个是已经封装好的,只需要设置正确的InputType就行了

keyboardType: c.isCustomKeyboard ? CustomKeyboard.inputType : TextInputType.text,

onTap:(){
 isCustomKeyboard = !isCustomKeyboard ;
 setState((){});
}

上面方法无法进行切换呀,始终会保持第一次显示的 keyboardType, 有没有案例?

Im-Kevin commented 1 year ago

这个切换需要有unfocus和focus的过程才行,不然这个不会变的

ZMNOTZ commented 1 year ago
image

像图中在自定义键盘里切换系统输入法,有什么办法吗?目前我二次封装了TextField,通过performPrivateCommand方式来通知组件的onAppPrivateCommand方法切换textInputType 做的。

ZMNOTZ commented 1 year ago

这个切换需要有unfocus和focus的过程才行,不然这个不会变的 在自定义键盘里切换系统输入法,有什么办法吗?目前我二次封装了TextField,通过performPrivateCommand方式来通知组件的onAppPrivateCommand方法切换textInputType 做的。

ddxl123 commented 1 year ago

我用unfocus和focus,之间间隔200毫秒的异步延迟就可以了。