keyboard_dismisser 3.0.0 copy "keyboard_dismisser: ^3.0.0" to clipboard
keyboard_dismisser: ^3.0.0 copied to clipboard

A simple Flutter package to hide the keyboard when performing a gesture outside of it.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:keyboard_dismisser/keyboard_dismisser.dart';

void main() => runApp(ExampleApp());

class ExampleApp extends StatelessWidget {
  const ExampleApp({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'Keyboard Dismisser',
        theme: ThemeData(primarySwatch: Colors.blue),
        home: ExamplePage(),
      );
}

class ExamplePage extends StatelessWidget {
  const ExamplePage({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) => KeyboardDismisser(
        gestures: [
          GestureType.onTap,
          GestureType.onPanUpdateDownDirection,
        ],
        child: Scaffold(
          appBar: AppBar(
            title: Text('KeyboardDismisser example'),
          ),
          body: Padding(
            padding: const EdgeInsets.symmetric(
              horizontal: 24,
              vertical: 48,
            ),
            child: TextField(
              decoration: InputDecoration(
                border: OutlineInputBorder(),
                labelText: 'Tap to show the keyboard',
                hintText: 'Tap elsewhere or swipe down to dismiss',
              ),
            ),
          ),
        ),
      );
}
232
likes
160
pub points
97%
popularity

Publisher

unverified uploader

A simple Flutter package to hide the keyboard when performing a gesture outside of it.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on keyboard_dismisser