FocusNode _focusNode = FocusNode();
@override
void initState() {
_focusNode.addListener(() {
if (!_focusNode.hasFocus) {
// TextField has lost focus
//收回键盘
FocusScope.of(context).requestFocus(FocusNode());
}
});
super.initState();
}
[Flutter]输入框获取焦点和失去焦点事件
最新推荐文章于 2024-06-22 18:48:32 发布