RemoteLinearProgressIndicator

Functions summary

Unit
@RemoteComposable
@Composable
RemoteLinearProgressIndicator(
    progress: RemoteFloat,
    modifier: RemoteModifier,
    colors: RemoteProgressIndicatorColors,
    strokeWidth: RemoteDp,
    enabled: RemoteBoolean
)

Material Design linear progress indicator.

Functions

RemoteLinearProgressIndicator

@RemoteComposable
@Composable
fun RemoteLinearProgressIndicator(
    progress: RemoteFloat,
    modifier: RemoteModifier = RemoteModifier,
    colors: RemoteProgressIndicatorColors = RemoteProgressIndicatorDefaults.colors(),
    strokeWidth: RemoteDp = RemoteLinearProgressIndicatorDefaults.StrokeWidthLarge,
    enabled: RemoteBoolean = true.rb
): Unit

Material Design linear progress indicator.

The RemoteLinearProgressIndicator displays progress as a horizontal bar, consisting of two visual components:

  • Track: The background line representing the total range of progress.

  • Indicator: A colored line that fills the track, indicating the current progress value.

The indicator also includes a small dot at the end of the progress line. This dot serves as an accessibility feature to show the range of the indicator.

import androidx.compose.remote.creation.compose.modifier.width
import androidx.compose.remote.creation.compose.state.rdp
import androidx.compose.remote.creation.compose.state.rf
import androidx.wear.compose.remote.material3.RemoteLinearProgressIndicator

RemoteLinearProgressIndicator(modifier = modifier.width(140.rdp), progress = 0.66f.rf)

For an animated progress, see:

import androidx.compose.remote.creation.compose.action.valueChange
import androidx.compose.remote.creation.compose.modifier.clickable
import androidx.compose.remote.creation.compose.state.animateRemoteFloatAsState
import androidx.compose.remote.creation.compose.state.rememberMutableRemoteFloat
import androidx.compose.remote.creation.compose.state.remoteTween
import androidx.compose.remote.creation.compose.state.rf
import androidx.wear.compose.remote.material3.RemoteLinearProgressIndicator

val progress = rememberMutableRemoteFloat { 0.25f.rf }
val animatedProgress =
    animateRemoteFloatAsState(
        targetValue = progress,
        animationSpec = remoteTween(durationMillis = 250),
    )
val toggleAction = valueChange(progress, (progress + 0.25f) % 1f)
RemoteLinearProgressIndicator(
    modifier = modifier.clickable(toggleAction),
    progress = animatedProgress,
)
Parameters
progress: RemoteFloat

The progress of this progress indicator where 0.0 represents no progress and 1.0 represents completion. Values outside of this range are coerced into the range 0..1.

modifier: RemoteModifier = RemoteModifier

Modifier to be applied to the RemoteLinearProgressIndicator.

colors: RemoteProgressIndicatorColors = RemoteProgressIndicatorDefaults.colors()

RemoteProgressIndicatorColors that will be used to resolve the indicator and track colors for this progress indicator in different states.

strokeWidth: RemoteDp = RemoteLinearProgressIndicatorDefaults.StrokeWidthLarge

The stroke width for the progress indicator. Defaults to RemoteLinearProgressIndicatorDefaults.StrokeWidthLarge.

enabled: RemoteBoolean = true.rb

Controls the enabled state. Although this component is not clickable, it can be contained within a clickable component. When enabled is false, this component will appear visually disabled. Note that only constant values are currently supported for enabled; expressions will evaluate to true.