Skip to content

Commit

Permalink
adds usage paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
drogel committed Apr 19, 2020
1 parent 930fd65 commit 39954fa
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 9 deletions.
68 changes: 60 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,65 @@

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

## Getting Started
[![Pub](https://img.shields.io/pub/v/keyboard_attachable.svg)](https://pub.dartlang.org/packages/keyboard_attachable)

This project is a starting point for a Dart
[package](https://flutter.dev/developing-packages/),
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.
![Example](./keyboard_attachable.gif)

For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
## Features


## 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.

```dart
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:

```yaml
dependencies:
keyboard_attachable: "^[LATEST_VERSION]"
```
Then run `$ flutter pub get`. In your library, add the following import:

```dart
import 'package:keyboard_attachable/keyboard_attachable.dart';
```

## Author

Diego Rogel - [GitHub](https://github.com/drogel)

## Changelog

Check the [Changelog](./CHANGELOG.md) page to see what's recently changed.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
2 changes: 1 addition & 1 deletion lib/src/footer_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart';
///
/// This widget builds a [CustomMultiChildLayout] whose delegate loosely
/// positions a footer widget at the bottom of the available space first,
/// and then positions its child widget in the remaining space with loose
/// and then positions a child widget in the remaining space with loose
/// constraints.
class FooterLayout extends StatelessWidget {
/// Creates a layout with its child widget above a footer widget.
Expand Down

0 comments on commit 39954fa

Please sign in to comment.