KeyboardDismiss class

Provides functionality so that by tapping on descendant widgets (except textfields) the keyboard is dismissed.

This functionality replicates that of Android apps, where the keyboard can be dismissed by either tapping outside of the keyboard or sometimes on another interactable element, like a button.

However, on iOS this behaviour is not common. Typically, the keyboard is dismissed when:

  • The page is scrolled up/down (like in Android, typically)
  • The user interacts with another interactable element (e.g., a toggle button)
  • The user slides down on the text input on a messaging app (e.g., iMessage)

Tapping on non-interactable elements does not bring the keyboard down on iOS. As such, when implementing this functionality, you must take care that the methods used to dismiss the keyboard are familiar to each platforms' users if possible.

Inheritance
Available Extensions

Constructors

KeyboardDismiss({required Widget child, Key? key, VoidCallback? onDismissed, bool shouldDismiss = true})
Provides functionality so that by tapping on descendant widgets (except textfields) the keyboard is dismissed.
const

Properties

child Widget
The widget that will have this functionality implemented.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDismissed VoidCallback?
A function called whenever the keyboard is dismissed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shouldDismiss bool
Whether the keyboard should be dismissed.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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.
override
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