FocusOnIt class

A widget that notifies when it is focused, unfocused, visible, or invisible.

Inheritance

Constructors

FocusOnIt({required Widget child, GlobalKey<State<StatefulWidget>>? focusKey, VoidCallback? onFocus, VoidCallback? onUnfocus, VoidCallback? onVisibilityGained, VoidCallback? onVisibilityLost, VoidCallback? onForegroundGained, VoidCallback? onForegroundLost, VoidCallback? onDetach, Future<AppExitResponse> onExitRequested()?, VoidCallback? onHide, VoidCallback? onInactive, VoidCallback? onRestart, VoidCallback? onShow, void onStateChange(AppLifecycleState? oldState, AppLifecycleState newState)?, Key? key})
A widget that notifies when a widget is focused or unfocused and react to it.
const

Properties

child Widget
The widget below this widget in the tree.
final
focusKey GlobalKey<State<StatefulWidget>>?
The key to be used by the widget responsible for detect the visibility of the widget.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onDetach VoidCallback?
Callback triggered when the app is detached from the view hierarchy.
final
onExitRequested → (Future<AppExitResponse> Function()?)
Callback triggered when the app is requested to exit.
final
onFocus VoidCallback?
Equivalent to onResume() on Android and viewDidAppear() on iOS. Triggered when the widget is focused after route transition or the widget resumed from a paused state.
final
onForegroundGained VoidCallback?
Triggered when the widget is visible after route transition.
final
onForegroundLost VoidCallback?
Triggered when the widget is no longer visible after route transition.
final
onHide VoidCallback?
Callback triggered when the app's window becomes hidden.
final
onInactive VoidCallback?
Callback triggered when the app is in an inactive state.
final
onRestart VoidCallback?
Callback triggered when the app is restarted.
final
onShow VoidCallback?
Callback triggered when the app's window becomes visible.
final
onStateChange → (void Function(AppLifecycleState? oldState, AppLifecycleState newState)?)
Callback triggered when the app's lifecycle state changes.
final
onUnfocus VoidCallback?
Equivalent to onPause() on Android and viewDidDisappear() on iOS. Triggered when the widget is unfocused after route transition or the widget paused from a focused state.
final
onVisibilityGained VoidCallback?
Triggered when the app is resumed from a paused state.
final
onVisibilityLost VoidCallback?
Triggered when the app is paused from a resumed state.
final
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() State<FocusOnIt>
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