KeyboardAvoider class
Wraps the child in a AnimatedContainer
that adjusts its bottom padding
to accommodate the on-screen keyboard.
Unlike a Scaffold
, it only insets by the actual amount obscured by the keyboard.
If autoScroll is true and the child contains a focused widget such as a TextField
,
automatically scrolls so that it is just visible above the keyboard, plus any additional focusPadding.
Constructors
- KeyboardAvoider({Key key, @required Widget child, Duration duration: const Duration(milliseconds: 100), Curve curve: Curves.easeOut, bool autoScroll: false, double focusPadding: 12.0 })
Properties
- autoScroll → bool
-
Whether to auto-scroll to the focused widget after the keyboard appears. Defaults to false.
Could be expensive because it searches all the child objects in this widget's render tree.
final
- child → Widget
-
The child to embed. If the child is not a
ScrollView
, it is automatically embedded in aSingleChildScrollView
. If the child is aScrollView
, it must have aScrollController
.final - curve → Curve
-
Animation curve. Defaults to
easeOut
final - duration → Duration
-
Duration of the resize animation. Defaults to 100ms. To disable, set to
Duration.zero
.final - focusPadding → double
-
Space to put between the focused widget and the top of the keyboard. Defaults to 12.
Useful in case the focused widget is inside a parent widget that you also want to be visible.
final
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- key → Key
-
Controls how one widget replaces another widget in the tree. [...]
final, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
createState(
) → _KeyboardAvoiderState - Creates the mutable state for this widget at a given location in the tree. [...]
-
createElement(
) → StatefulElement -
Creates a
StatefulElement
to manage this widget's location in the tree. [...]inherited -
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of
DiagnosticsNode
objects describing this node's children. [...]@protected, inherited -
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 toStringDeep. [...]
inherited
-
toString(
{DiagnosticLevel minLevel: DiagnosticLevel.debug }) → String -
Returns 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 ==(
dynamic other) → bool -
The equality operator. [...]
inherited