LocationButton

Functions summary

Unit
@Composable
LocationButton(
    modifier: Modifier,
    backgroundColor: Color,
    strokeColor: Color,
    strokeWidth: Dp,
    cornerRadius: Dp,
    pressedCornerRadius: Dp,
    iconTint: Color,
    textType: LocationButtonTextType,
    textColor: Color,
    clickablePadding: PaddingValues,
    compositionOrder: Int,
    onRequestPermissions: (() -> Unit)?,
    onError: ((Throwable) -> Unit)?,
    onPermissionResult: (Boolean) -> Unit
)

Displays a location button either rendered by the system or rendered locally (as a fallback).

Functions

@Composable
fun LocationButton(
    modifier: Modifier = Modifier,
    backgroundColor: Color = LocationButtonDefaults.backgroundColor,
    strokeColor: Color = LocationButtonDefaults.strokeColor,
    strokeWidth: Dp = LocationButtonDefaults.strokeWidth,
    cornerRadius: Dp = LocationButtonDefaults.cornerRadius,
    pressedCornerRadius: Dp = LocationButtonDefaults.pressedCornerRadius,
    iconTint: Color = LocationButtonDefaults.iconTint,
    textType: LocationButtonTextType = LocationButtonDefaults.textType,
    textColor: Color = LocationButtonDefaults.textColor,
    clickablePadding: PaddingValues = LocationButtonDefaults.clickablePadding,
    compositionOrder: Int = LocationButtonDefaults.defaultCompositionOrder,
    onRequestPermissions: (() -> Unit)? = null,
    onError: ((Throwable) -> Unit)? = null,
    onPermissionResult: (Boolean) -> Unit
): Unit

Displays a location button either rendered by the system or rendered locally (as a fallback).

Uses remote rendering on Build.VERSION_CODES.CINNAMON_BUN and later. Falls back to a local Compose implementation on platforms before Build.VERSION_CODES.CINNAMON_BUN or if remote rendering fails.

Parameters
modifier: Modifier = Modifier

Optional Modifier for the button layout.

backgroundColor: Color = LocationButtonDefaults.backgroundColor

Optional background color.

strokeColor: Color = LocationButtonDefaults.strokeColor

Optional stroke color.

strokeWidth: Dp = LocationButtonDefaults.strokeWidth

Optional stroke width.

cornerRadius: Dp = LocationButtonDefaults.cornerRadius

Optional corner radius.

pressedCornerRadius: Dp = LocationButtonDefaults.pressedCornerRadius

Optional corner radius when pressed.

iconTint: Color = LocationButtonDefaults.iconTint

Optional icon tint.

textType: LocationButtonTextType = LocationButtonDefaults.textType

The predefined LocationButtonTextType to display.

textColor: Color = LocationButtonDefaults.textColor

Optional text color.

clickablePadding: PaddingValues = LocationButtonDefaults.clickablePadding

Optional padding between the clickable boundary and the visual button.

compositionOrder: Int = LocationButtonDefaults.defaultCompositionOrder

Optional Z-order for the remote surface.

onRequestPermissions: (() -> Unit)? = null

Optional callback when clicked on platforms before Build.VERSION_CODES.CINNAMON_BUN. If not provided, the button will automatically request location permissions using standard platform dialogs.

onError: ((Throwable) -> Unit)? = null

Optional callback invoked if the remote rendering session fails. Clients can use this to trigger a retry or display a custom fallback UI.

onPermissionResult: (Boolean) -> Unit

Called with the permission result. Invoked on older platforms after the permission request completes (either default or custom), and on Build.VERSION_CODES.CINNAMON_BUN and later after the system-managed secure flow completes.