Flutter 之点击空白处取消TextField焦点

GestureDetector(
    behavior: HitTestBehavior.translucent,
    onTap: () {
        // 触摸收起键盘
        FocusScope.of(context).requestFocus(FocusNode());
    },
    child: *******
}

注:一定要放到最外层

相关推荐