KeyboardAttachable class Null safety

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.

Even if no child widget is passed to KeyboardAttachable, it can still be used to animate the shrinkage and expansion of the layout when the keyboard is shown an hidden, respectively. In order for this to work, this widget has to be attached to the bottom of the page, for example, by using a FooterLayout, and the Scaffold.resizeToAvoidBottomInset parameter of the Scaffold above the page has to be set to false.

In addition to that, when there are SafeAreas involved the layout, it is recommended to set their SafeArea.maintainBottomViewPadding property to true in order for the animations to run smoothly.



KeyboardAttachable({Widget? child, KeyboardTransitionBuilder transitionBuilder = KeyboardAttachable._defaultBuilder, Color backgroundColor = Colors.transparent, Key? key})
Creates a widget that smoothly adds space below its child when the keyboard is shown or hidden.


backgroundColor Color
The color that fills the space that is added when the keyboard appears.
child Widget?
The widget to be placed above the space that this widget can insert.
hashCode int
The hash code for this object.
key Key?
Controls how one widget replaces another widget in the tree.
runtimeType Type
A representation of the runtime type of the object.
transitionBuilder KeyboardTransitionBuilder
A function that wraps a new child with an animation that makes the keyboard appear when the animation runs in the forward direction and hide when the animation runs in the reverse direction.


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


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