🌈 Create new beautiful Compose Gradients with our new wesite ->
Interface

FocusProperties

Properties that are applied to focusTarget that is the first child of the FocusPropertiesModifierNode that sets these properties.

Source set: Common
public interface FocusProperties

Properties that are applied to focusTarget that is the first child of the FocusPropertiesModifierNode that sets these properties.

Properties

canFocus

Source set: Common
public var canFocus: Boolean

When set to false, indicates that the focusTarget that this is applied to can no longer take focus. If the focusTarget is currently focused, setting this property to false will end up clearing focus.

next

Source set: Common
public var next: FocusRequester

A custom item to be used when the user requests the focus to move to the "next" item.

previous

Source set: Common
public var previous: FocusRequester

A custom item to be used when the user requests the focus to move to the "previous" item.

up

Source set: Common
public var up: FocusRequester

A custom item to be used when the user moves focus "up".

down

Source set: Common
public var down: FocusRequester

A custom item to be used when the user moves focus "down".

left

Source set: Common
public var left: FocusRequester

A custom item to be used when the user requests a focus moves to the "left" item.

Source set: Common
public var right: FocusRequester

A custom item to be used when the user requests a focus moves to the "right" item.

start

Source set: Common
public var start: FocusRequester

A custom item to be used when the user requests a focus moves to the "left" in LTR mode and "right" in RTL mode.

end

Source set: Common
public var end: FocusRequester

A custom item to be used when the user requests a focus moves to the "right" in LTR mode and "left" in RTL mode.

enter

Source set: Common
public var enter: (FocusDirection) -> FocusRequester

A custom item to be used when the user requests focus to move focus in (FocusDirection.Enter). An automatic Enter" can be triggered when we move focus to a focus group that is not itself focusable. In this case, users can use the the focus direction that triggered the move in to determine the next item to be focused on.

When you set the enter property, provide a lambda that takes the FocusDirection that triggered the enter as an input, and provides a FocusRequester as an output. You can return a custom destination by providing a FocusRequester attached to that destination, a Cancel to cancel the focus enter or Default to use the default focus enter behavior.

onEnter

Source set: Common
public var onEnter: FocusEnterExitScope.() -> Unit

A custom item to be used when the user requests focus to move focus in (FocusDirection.Enter). An automatic Enter" can be triggered when we move focus to a focus group that is not itself focusable. In this case, users can use the the focus direction that triggered the move in to determine the next item to be focused on.

When you set the onEnter property, provide a lambda with the FocusEnterExitScope scope, having the FocusEnterExitScope.requestedFocusDirection that triggered the enter as an input. If redirection is required, use FocusRequester.requestFocus and if the focus change should be canceled, use FocusEnterExitScope.cancelFocusChange.

exit

Source set: Common
public var exit: (FocusDirection) -> FocusRequester

A custom item to be used when the user requests focus to move out (FocusDirection.Exit). An automatic Exit can be triggered when we move focus outside the edge of a parent. In this case, users can use the focus direction that triggered the move out to determine the next focus destination.

When you set the exit property, provide a lambda that takes the FocusDirection that triggered the exit as an input, and provides a FocusRequester as an output. You can return a custom destination by providing a FocusRequester attached to that destination, a Cancel to cancel the focus exit or Default to use the default focus exit behavior.

onExit

Source set: Common
public var onExit: FocusEnterExitScope.() -> Unit

A custom item to be used when the user requests focus to move out (FocusDirection.Exit). An automatic Exit can be triggered when we move focus outside the edge of a parent. In this case, users can use the focus direction that triggered the move out to determine the next focus destination.

When you set the onExit property, provide a lambda with the FocusEnterExitScope scope, having the FocusEnterExitScope.requestedFocusDirection that triggered the exit as an input. If redirection is required, use FocusRequester.requestFocus and if the focus change should be canceled, use FocusEnterExitScope.cancelFocusChange.

focusRect

Source set: Common
public var focusRect: Rect

Sets the focus area for the associated focus target to which these FocusProperties are applied on.

If you simply ignore and do not set this value, UnsetFocusRect will be used. Or alternatively you can set this value to UnsetFocusRect to prevent other FocusProperties nodes in the chain from customizing the focus area.

Members

Companion

Source set: Common
public companion object

Properties

UnsetFocusRect

Source set: Common
public val UnsetFocusRect: Rect = Rect(Float.NaN, Float.NaN, Float.NaN, Float.NaN)

Denotes that the bounds of the associated focus target should be used as the focus area.

Content updated: