mobile_skt/lib/widgets/tap_to_dismiss_keyboard.dart

23 lines
515 B
Dart

import 'package:flutter/cupertino.dart';
class TapToDismissKeyboard extends StatelessWidget {
final Widget? child;
late BuildContext context;
TapToDismissKeyboard({this.child, required context});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
TapToDismissKeyboard.dismissOf(context: context);
},
child: child,
);
}
static dismissOf({required BuildContext context}) {
FocusScope.of(context).requestFocus(FocusNode());
}
}