flutter 统一处理点击空白收起键盘

 home: SpalshPage(),
                  // home: HomePage1(),
                  debugShowCheckedModeBanner: false,
                  builder: (context, c) {

                    /// 统一加入点击空白出收键盘
                    return GestureDetector(
                        onTap: (){
                          FocusScopeNode currentFocus = FocusScope.of(context);
                          if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
                            FocusManager.instance.primaryFocus?.unfocus();
                          }
                        },child:MediaQuery(
                      /// 保证文字大小不受手机系统设置影响 https://www.kikt.top/posts/flutter/layout/dynamic-text/
                      data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
                      child: FlutterEasyLoading(child: c),
                    ) );
                  },

你可能感兴趣的:(flutter 统一处理点击空白收起键盘)