import 'package:flutter/cupertino.dart'; class TapToDismissKeyboard extends StatelessWidget { final Widget? child; final BuildContext context; const TapToDismissKeyboard({super.key, this.child, required this.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()); } }