Code Monkey home page Code Monkey logo

keyboard_attachable's Introduction

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.

keyboard_attachable's People

Contributors

drogel avatar faiyyaz avatar diegorogel avatar jjagg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.