KeyboardVisibilityProvider class

Widget that reports to its descendants whether or not the keyboard is currently visible.

Example usage:

// A Builder is used in this example solely for the purpose
// of demonstrating ancestor access from within a single
// build() method. You do not need to use a Builder if you
// access KeyboardVisibilityProvider from within a custom
// StatelessWidget or StatefulWidget.
return KeyboardVisibilityProvider(
  child: Builder(
    builder: (BuildContext context) {
      final bool isKeyboardVisible = KeyboardVisibilityProvider.isKeyboardVisible(context);

      return Text('Keyboard is visible: $isKeyboardVisible');
    },
  ),
);
Inheritance

Constructors

KeyboardVisibilityProvider({Key? key, required Widget child, KeyboardVisibilityController? controller})
const

Properties

child Widget
final
controller KeyboardVisibilityController?
Optional: pass in a controller you already have created. This is useful for testing, as you can pass in a mock instance. If no controller is passed in, one will be created automatically.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → _KeyboardVisibilityProviderState
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

Static Methods

isKeyboardVisible(BuildContext context) bool
Returns true if the keyboard is currently visible, false if the keyboard is not currently visible, or null if the flutter_keyboard_visibility plugin does not yet know if the keyboard is visible.