keyboard_actions 5.0.0
keyboard_actions: ^5.0.0 copied to clipboard
Add a keyboard toolbar in Flutter with Done, Prev/Next, custom bars, and custom keyboards. Works in forms, lists, dialogs, and sheets.
5.0.0 #
- Breaking rewrite focused on being the most reliable keyboard UX package for Flutter.
- No scroll hijacking: removed
BottomAreaAvoideras the default path. The toolbar floats in anOverlay, and the toolbar height is reserved at the bottom of the child so Scaffold / ListView / Dialog / BottomSheet / slivers react naturally. - Uses
Scrollable.ensureVisibleto keep the focused field visible. - Keep
Scaffold.resizeToAvoidBottomInset: true(Flutter default). No morefalserequirement. - New primary API, three names for almost every use:
KeyboardActions: Prev/Next/Done (auto) with zero FocusNode setupKeyboardActions.done: Done only. Wrap a body, a scrollable, or one fieldKeyboardField: local per-field config & custom keyboard footers (no global action lists)
- Wrap it anywhere.
KeyboardActionsreserves the toolbar height at the bottom of its child, which inside a scrollable becomes extra scroll extent and around one shrinks the viewport by exactly the covered pixels. Both positions now behave identically, so the previous "where do I wrap?" rules are gone.- This also fixes a real bug: a field at the bottom of a
ListViewstayed partly behind the bar even when wrapping the list, becauseListView's automatic padding comes fromMediaQuery.paddingand never saw the inflatedviewInsets.
- This also fixes a real bug: a field at the bottom of a
- Public API trimmed from 18 exported names to 10.
KeyboardActionsController,KeyboardActionsScope,KeyboardActionsTapRegion,KeyboardBar,KeyboardFieldState,PlatformCheckandPlatformCheckTypeare now internal. UsekIsWeb/defaultTargetPlatformfor platform checks. - Custom keyboards via
KeyboardField.footer/footerBuilder+KeyboardCustomInput+KeyboardCustomPanelMixin. - Material 3-aware bar styling; iOS 26 rounded bar + gap by default.
- All bar appearance in
KeyboardActionsThemeData: colors, height, elevation, radius, padding,doneTextStyle/submitTextStyle, custom arrow icons,doneText/submitText,integratedBar.- Apply app-wide with
KeyboardActionsTheme, or viaThemeData.extensions(it is aThemeExtension). - Override one instance with
KeyboardActions.theme. - Replaces the
barColor,barHeightandintegratedBarparameters.
- Apply app-wide with
Submitnow requiresonSubmit, and it replaces Done on the last field instead of sitting next to it: submitting is the primary action there.- Fixed
dismissOnTapOutside, which never dismissed on iOS/Android touch. Two causes: the guard meant to protect field-to-field taps also blocked taps on inert space, and the deferred check ran in a post-frame callback without requesting a frame. - Dismissal now happens on pointer up and ignores drags, so starting a scroll no longer closes the keyboard.
- Callbacks no longer overlap:
KeyboardActions.onDoneis nowonDismissed, since it also fires whendismissOnTapOutsidecloses the keyboard.KeyboardField.onDonekeeps meaning "this field's Done button" and still runs first.onSubmitis unchanged. enabled+platformEnabledcollapsed into onebool? enabled:null= auto (iOS + Android),true= always,false= never.- Custom keyboard panels (and their Done bar) slide down on dismiss and up on show, matching a soft-keyboard motion instead of popping away.
- Removed
KeyboardField.done,StandaloneKeyboardFieldandKeyboardActionsInsetScope.KeyboardActions.done(child: TextField(...))already covered the single-field case, and reserving space made the inset scope unnecessary. - README preview GIFs under
doc/gifs/(record with./tool/record_readme_gifs.sh).
4.2.2 #
- A lot of fixes
4.2.1 #
- Fix Dart 3.10 nullability error. Thanks
paul-charlton.
4.2.0 #
- removed unfocusing for android on keyboard change (bug). Thanks
raphire08. - minor lints for flutter 3.7.3.
4.1.0 #
- Dismiss the bar when the android back button is pressed (bug). Thanks
monster555.
4.0.1 #
- Adds
keyboardBarElevationtoKeyboardActionsConfig. ThanksRooa94.
4.0.0 #
- Update to Flutter 3.0. Thanks
ashim-kr-sahaandRoaa94.