soft_keyboard_dismisser 0.0.3
soft_keyboard_dismisser: ^0.0.3 copied to clipboard
A simple Flutter package to dismiss the keyboard when click outside the input field..
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:soft_keyboard_dismisser/soft_keyboard_dismisser.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
var value = "";
@override
void initState() {
super.initState();
}
onTextChange(val) {
print(val);
setState(() {
value = val;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Keyboard Dismisser'),
),
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 20,
),
Text(value),
SoftKeyboardDismisser(false, "Type here..", 10.0, onTextChange),
],
),
),
),
);
}
}