unfocus_widget 0.0.6 copy "unfocus_widget: ^0.0.6" to clipboard
unfocus_widget: ^0.0.6 copied to clipboard

retracted

Useful widget for unfocusing the TextField when touching outside

unfocus_widget #

Wrap your UI with UnFocusWidget so tapping outside TextFields dismisses the keyboard.

Add the dependency #

dependencies:
  unfocus_widget: <latest>
dart pub add unfocus_widget

Use it #

import 'package:unfocus_widget/unfocus_widget.dart';

Put it around the area that should receive “outside” taps—usually Scaffold.body:

Scaffold(
  body: UnFocusWidget(
    child: Padding(
      padding: const EdgeInsets.all(16),
      child: Column(
        children: [
          TextField(decoration: InputDecoration(labelText: 'Email')),
          TextField(decoration: InputDecoration(labelText: 'Password')),
        ],
      ),
    ),
  ),
);

With a scrollable form, wrap the scroll view:

body: UnFocusWidget(
  child: SingleChildScrollView(
    padding: const EdgeInsets.all(16),
    child: Column(
      children: [
        // TextFields...
      ],
    ),
  ),
),

Run the demo: cd example && flutter run

Repository: https://github.com/thomas-p95/unfocus_widget

7
likes
0
points
632
downloads

Publisher

verified publishersimpleman.dev

Weekly Downloads

Useful widget for unfocusing the TextField when touching outside

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on unfocus_widget