OpenFlutter / flutter_screenutil

Flutter screen adaptation, font adaptation, get screen information
https://pub.dartlang.org/packages/flutter_screenutil
Apache License 2.0
3.85k stars 486 forks source link

`FocusScope.of(context).unfocus()` Don't work #492

Closed RealYoungk closed 1 year ago

RealYoungk commented 1 year ago

The keyboard won't go down when I run "FocusScope.of(context).unfocus()". How can I lower the keyboard?

flutter_screenutil: ^5.7.0

@override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      useInheritedMediaQuery: true,
return GestureDetector(
      onTap: () => FocusScope.of(context).unfocus(),
Mounir-Bouaiche commented 1 year ago

Hello @RealYoungk , you need to provide minimal working code to reproduce problem. Are you trying to call FocusScope.of(context) outside MaterialApp context ?

RealYoungk commented 1 year ago

Hello @Mounir-Bouaiche

I think I referenced the wrong context. Thank you.