Search packages, repositories and app categories

flutter_keyboard_size cover
Package detailsv1.0.1

flutter_keyboard_size

A straightforward and convenient provider that helps get info about - keyboard height, is it open or not, set bool value is screen small or not.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
20.2K
Likes
67
Pub points
160

Install package

flutter pub add flutter_keyboard_size

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

flutter_keyboard_size is a lightweight Flutter package that provides real-time information about the on-screen keyboard, including its height and whether it's open. It also helps determine if the screen size is small, useful for responsive UI adjustments. The package offers a simple provider-based API to access keyboard state and dimensions across multiple platforms, ensuring consistent behavior on Android, iOS, Web, macOS, Windows, and Linux. Ideal for apps needing dynamic layout adaptation when the keyboard appears or disappears.

Use cases

  • Adjusting UI layout when keyboard opens
  • Detecting keyboard visibility in forms
  • Responsive design for small screens
  • Handling input field positioning
  • Dynamic padding based on keyboard height

Key features

  • Real-time keyboard height detection
  • Keyboard open/close state monitoring
  • Screen size classification
  • Provider-based state management
  • Cross-platform support
  • Simple API integration

Suitable for

  • Form-heavy applications
  • Chat or messaging interfaces
  • Mobile-first UIs
  • Responsive layouts
  • Apps requiring dynamic input handling

Considerations

  • May require rebuilds on state changes
  • Limited to keyboard-related metrics
  • Not suitable for complex gesture detection
  • Depends on platform-specific keyboard events
  • Best used with state management like Provider

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

flutter_keyboard_size Pub

When the virtual keyboard is opened, we can get its height with MediaQuery.of(context).viewInsets.bottom

BUT, in case of complicated widgets tree, it doesn't work. So, every time we have to mutate the keyboard size down to the widget tree.

This package is a straightforward and convenient provider that helps get info about: keyboard height, is it open or not, set bool value is screen small or not.

Showcase|100x100, 10%

Usage

After installing wrap Scaffold widget to

KeyboardSizeProvider(
      smallSize: 500.0,
      child: Scaffold(

where smallSize property is optional, default is 400.0

After that, down to the widget tree you can use Consumer widget to get info about keyboard

Widget build(BuildContext context) {
    return Consumer<ScreenHeight>(
      builder: (context, _res, child) {
        return Center(

available properties:

  double keyboardHeight
  double screenHeight
  bool isSmall // returns true if screen height becomes less then smallSize property
  bool isOpen // true if open

Full example is here https://github.com/awaik/flutter_keyboard_size/tree/master/example

Credits

This is a project by Agoradesk, P2P cryptocurrency trading platform. Created by the team behind LocalMonero, the biggest and most trusted Monero P2P trading platform.

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package