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.

Inheritance

Constructors

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.
const

Properties

backgroundColor Color
The color that fills the space that is added when the keyboard appears.
final
child Widget?
The widget to be placed above the space that this widget can insert.
final
hashCode int
The hash code for this object.
@nonVirtualread-onlyinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
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.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _KeyboardAttachableState
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.
@protectedinherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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.
@nonVirtualinherited