flutter_keyboard_size
1.0.1, released 4 years ago by agoradesk.com
Provider to get virtual keyboard height, open state, and small screen status.
What it does
Provides a straightforward KeyboardSizeProvider and Consumer pattern to access keyboard height, whether the keyboard is open, and whether the screen is considered small. It avoids issues with MediaQuery.info inside complicated widget trees.
AI-written summary of version 1.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to easily access the virtual keyboard height or open state deep down in a widget tree
- You want to detect if the screen height falls below a custom threshold
Skip it when
- You already manage app state with another provider setup and prefer standard MediaQuery or native edge-to-edge handling
- You do not need to track virtual keyboard dimensions
Strengths
- Simplifies keyboard state management across deeply nested widget trees
- Includes helpful built-in properties for screen size threshold checks
- Easy setup by wrapping the Scaffold
Weaknesses
- Relies on the older provider package ecosystem
- Limited functionality beyond keyboard metrics and basic screen size checks
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Wrap the Scaffold widget with KeyboardSizeProvider.
KeyboardSizeProvider(
smallSize: 500.0,
child: Scaffold(
body: Consumer<ScreenHeight>(
builder: (context, _res, child) {
return Center(
child: Text('Keyboard open: ${_res.isOpen}'),
);
},
),
),
)Alternatives
Packages that do the same job and could replace flutter_keyboard_size.
- jetpack
Android Jetpack inspired abstractions and utilities for state management in Flutter.
50Compare - generic_bloc_provider
A generic InheritedWidget-based provider for BLoC state management in Flutter.
46Compare
Works with
Packages commonly used together with flutter_keyboard_size: ones it builds on, ones built on it, and its own family.