KeyboardActions class

A widget that shows a bar of actions above the keyboard, to help customize input.

To use this class, add it somewhere higher up in your widget hierarchy. Then, from any child widgets, add KeyboardActionsConfig to configure it with the KeyboardActions you'd like to use. These will be displayed whenever the wrapped focus nodes are selected.

This widget wraps a KeyboardAvoider, which takes over functionality from Scaffold: when the focus changes, this class re-sizes child's focused object to still be visible, and scrolls to the focused node. As such, set Scaffold.resizeToAvoidBottomInset to false when using this Widget.

We manage resizing ourselves so that:

  1. using scaffold is not required
  2. content is only shrunk as needed (a problem with scaffold)
  3. we shrink an additional _kBarSize so the keyboard action bar doesn't cover content either.
Inheritance

Constructors

KeyboardActions({Widget? child, ScrollPhysics? bottomAvoiderScrollPhysics, bool enable = true, bool autoScroll = true, bool isDialog = false, bool tapOutsideToDismiss = false, required KeyboardActionsConfig config, double overscroll = 12.0, bool disableScroll = false})
const

Properties

autoScroll bool
If you want the content to auto-scroll when focused; see KeyboardAvoider.autoScroll
final
bottomAvoiderScrollPhysics ScrollPhysics?
If you want to control the scroll physics of BottomAreaAvoider which uses a SingleChildScrollView to contain the child.
final
child Widget?
Any content you want to resize/scroll when the keyboard comes up
final
config KeyboardActionsConfig
Keyboard configuration
final
disableScroll bool
If you are using KeyboardActions for just one textfield and don't need to scroll the content set this to true
final
enable bool
In case you don't want to enable keyboard_action bar (e.g. You are running your app on iPad)
final
hashCode int
The hash code for this object.
no setterinherited
isDialog bool
If you are using keyboard_actions inside a Dialog it must be true
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
overscroll double
If you want to add overscroll. Eg: In some cases you have a TextField with an error text below that.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tapOutsideToDismiss bool
Tap outside the keyboard will dismiss this
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() KeyboardActionstate
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited