📅  最后修改于: 2022-03-11 14:48:06.588000             🧑  作者: Mango
class _HomeState extends State {
var currentFocus;
unfocus() {
currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
}
Widget build(BuildContext context) {
return GestureDetector(
onTap: unfocus,
child: Scaffold(...)
)
}