mobile_skt/lib/widgets/tap_to_dismiss_keyboard.dart

22 lines
537 B
Dart

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());
}
}