FocusTargetModifierNode
-
Cmn
sealed interface FocusTargetModifierNode : DelegatableNode
This modifier node can be delegated to in order to create a modifier that makes a component focusable.
Summary
Public functions |
||
|---|---|---|
Boolean |
requestFocus(focusDirection: FocusDirection)Request focus for this node. |
Cmn
|
Public properties |
||
|---|---|---|
FocusState |
The |
Cmn
|
Focusability |
The |
Cmn
|
Extension functions |
||
|---|---|---|
Rect? |
Calculates the rectangular area in this node's coordinates that corresponds to the focus area of the focused node under this |
Cmn
|
Inherited functions |
|---|
Inherited properties |
|||
|---|---|---|---|
|
Public functions
requestFocus
fun requestFocus(focusDirection: FocusDirection = FocusDirection.Enter): Boolean
Request focus for this node.
| Parameters | |
|---|---|
focusDirection: FocusDirection = FocusDirection.Enter |
The direction from which the focus is being requested |
| Returns | |
|---|---|
Boolean |
true if focus was successfully requested |
Public properties
focusState
val focusState: FocusState
The FocusState associated with this FocusTargetModifierNode. When you delegate to a FocusTargetModifierNode, instead of implementing FocusEventModifierNode, you can get the state by accessing this variable.
focusability
var focusability: Focusability
The Focusability for this node.
Note that parent FocusPropertiesModifierNodes that set FocusProperties.canFocus take priority over this property.
If the current focus state would be affected by a new focusability, focus will be invalidated as needed.
Extension functions
getFocusedRect
fun FocusTargetModifierNode.getFocusedRect(): Rect?
Calculates the rectangular area in this node's coordinates that corresponds to the focus area of the focused node under this FocusTargetModifierNode, including itself.
This function returns null when;
-
This node is not focused and there is no focused descendant.
-
This node is detached from the composition hierarchy.