ClickableKt

Added in 1.3.0-alpha06

public final class ClickableKt


Summary

Public methods

static final @NonNull LayoutModifier
clickable(
    @NonNull LayoutModifier receiver,
    @NonNull ModifiersBuilders.Clickable clickable
)

Adds the clickable property of the modified element.

static final @NonNull LayoutModifier
clickable(
    @NonNull LayoutModifier receiver,
    @NonNull ActionBuilders.Action action,
    String id
)

Adds the clickable property of the modified element.

static final @NonNull ModifiersBuilders.Clickable
clickable(
    @NonNull ActionBuilders.Action action,
    String id,
    @RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableWidth,
    @RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableHeight
)

Creates a Clickable that allows the modified element to have actions associated with it, which will be executed when the element is tapped.

static final @NonNull ActionBuilders.LoadAction

Creates an action used to load (or reload) the layout contents.

static final @NonNull LayoutModifier
@RequiresSchemaVersion(major = 1, minor = 300)
minimumTouchTargetSize(
    @NonNull LayoutModifier receiver,
    @Dimension(unit = 0) float minWidth,
    @Dimension(unit = 0) float minHeight
)

Sets the minimum width and height of the clickable area.

Public methods

public static final @NonNull LayoutModifier clickable(
    @NonNull LayoutModifier receiver,
    @NonNull ModifiersBuilders.Clickable clickable
)

Adds the clickable property of the modified element. It allows the modified element to have actions associated with it, which will be executed when the element is tapped.

public static final @NonNull LayoutModifier clickable(
    @NonNull LayoutModifier receiver,
    @NonNull ActionBuilders.Action action,
    String id
)

Adds the clickable property of the modified element. It allows the modified element to have actions associated with it, which will be executed when the element is tapped.

Parameters
@NonNull ActionBuilders.Action action

is triggered whenever the element is tapped. By default adds an empty LoadAction.

String id

is the associated identifier for this clickable. This will be passed to the action handler.

public static final @NonNull ModifiersBuilders.Clickable clickable(
    @NonNull ActionBuilders.Action action,
    String id,
    @RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableWidth,
    @RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableHeight
)

Creates a Clickable that allows the modified element to have actions associated with it, which will be executed when the element is tapped.

Parameters
@NonNull ActionBuilders.Action action

is triggered whenever the element is tapped. By default adds an empty LoadAction.

String id

is the associated identifier for this clickable. This will be passed to the action handler.

@RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableWidth

of the clickable area. The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable width is not guaranteed unless there is enough space around the element within its parent bounds.

@RequiresSchemaVersion(major = 1, minor = 300) @Dimension(unit = 0) float minClickableHeight

of the clickable area. The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable height is not guaranteed unless there is enough space around the element within its parent bounds.

public static final @NonNull ActionBuilders.LoadAction loadAction(
    @ExtensionFunctionType Function1<@NonNull StateBuilders.State.BuilderUnit> requestedState
)

Creates an action used to load (or reload) the layout contents.

Parameters
@ExtensionFunctionType Function1<@NonNull StateBuilders.State.BuilderUnit> requestedState

is the State associated with this action. This state will be passed to the action handler.

minimumTouchTargetSize

@RequiresSchemaVersion(major = 1, minor = 300)
public static final @NonNull LayoutModifier minimumTouchTargetSize(
    @NonNull LayoutModifier receiver,
    @Dimension(unit = 0) float minWidth,
    @Dimension(unit = 0) float minHeight
)

Sets the minimum width and height of the clickable area. The default value is 48dp, following the Material design accessibility guideline. Note that this value does not affect the layout, so the minimum clickable width/height is not guaranteed unless there is enough space around the element within its parent bounds.