keyboard_attachable 1.0.3

  • Readme
  • Changelog
  • Installing
  • 89

keyboard_attachable #

A Flutter package to build widgets that can be attached to the soft keyboard.

Pub

Example

Features #

  • An alternative to Scaffold's resizeToAvoidBottomInset, with animations.
  • Control the animations that should happen when the soft keyboard is shown and hidden with a transition builder.
  • Animate the shrinkage and expansion of the page when the soft keyboard is shown and hidden, matching the platform soft keyboard animation.
  • Easily add permanent page footers that can be attached to the top of the soft keyboard.

Usage #

This package exposes a FooterLayout stateless widget and a KeyboardAttachable stateful widget.

FooterLayout is a widget that can lay out a child widget above a footer. It does that by positioning a footer widget at the bottom of the available space first, and then positioning a child widget in the remaining space.

    Widget build(BuildContext context) => FooterLayout(
          footer: MyFooterWidget(),
          child: PageMainContent(),
        );

KeyboardAttachable is a widget that adds space below its baseline when the soft keyboard is shown and hidden with an animation that matches that of the platform keyboard. This widget can be used to animate its child when the soft keyboard is shown or hidden, so that the child widget appears to be attached to the keyboard.

You can combine these two widgets by passing a KeyboardAttachable widget as the footer of a FooterLayout to create a page that shrinks and expands when the soft keyboard appears and disappears, with an animation that matches the platform keyboard animation. Additionally, you can pass a child widget to your KeyboardAttachable to have a footer in your page that attaches itself to the soft keyboard when shown.

In order for this to work with animations, the resizeToAvoidBottomInset parameter of the Scaffold above the page has to be false.

Getting started #

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  keyboard_attachable: "^[LATEST_VERSION]"

Then run $ flutter pub get. In your library, add the following import:

import 'package:keyboard_attachable/keyboard_attachable.dart';

Author #

Diego Rogel - GitHub

Changelog #

Check the Changelog page to see what's recently changed.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

[1.0.3] - May 2020 #

  • Moves keyboard visibility dependencies to flutter_visibility_package.
  • Refactors animation controllers and visibility stream subscription. Changes only affect internal componentsgit .

[1.0.2] - May 2020 #

  • Adds an example app to the project that makes use of the transitionBuilder parameter.
  • Improves documentation on transitionBuilder.

[1.0.1] - May 2020 #

  • Adds a transitionBuilder parameter to KeyboardAttachable that can be used to ontrol the animations that should happen when the soft keyboard is shown and hidden.

[1.0.0] - April 2020 #

  • Initial Open Source release.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  keyboard_attachable: ^1.0.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:keyboard_attachable/keyboard_attachable.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
78
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
89
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:keyboard_attachable/keyboard_attachable.dart that imports:
  • package:keyboard_attachable/src/keyboard_attachable.dart that imports:
  • package:keyboard_attachable/src/visibility/default_keyboard_visibility_controller.dart that imports:
  • package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:keyboard_attachable/keyboard_attachable.dart that imports:
  • package:keyboard_attachable/src/keyboard_attachable.dart that imports:
  • package:keyboard_attachable/src/visibility/default_keyboard_visibility_controller.dart that imports:
  • package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:keyboard_attachable/keyboard_attachable.dart that imports:
  • package:keyboard_attachable/src/keyboard_attachable.dart that imports:
  • package:keyboard_attachable/src/visibility/default_keyboard_visibility_controller.dart that imports:
  • package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:keyboard_attachable/keyboard_attachable.dart that imports:
  • package:keyboard_attachable/src/keyboard_attachable.dart that imports:
  • package:keyboard_attachable/src/visibility/default_keyboard_visibility_controller.dart that imports:
  • package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • keyboard_attachable that is a package requiring null.

Health suggestions

Fix lib/src/keyboard_attachable.dart. (-0.50 points)

Analysis of lib/src/keyboard_attachable.dart reported 1 hint:

line 7 col 8: Unused import: 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'.

Format lib/src/visibility/keyboard_visibility_controller.dart.

Run flutter format to format lib/src/visibility/keyboard_visibility_controller.dart.

Maintenance suggestions

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

Common filename patterns include main.dart, example.dart, and keyboard_attachable.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
flutter_keyboard_visibility ^3.1.0 3.2.1
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test