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.

Animates changes to progress with the RemoteMotionScheme.defaultEffectsSpec of RemoteMaterialTheme.motionScheme.

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)

Example that changes progress on click:

import androidx.compose.remote.creation.compose.action.valueChange
import androidx.compose.remote.creation.compose.modifier.clickable
import androidx.compose.remote.creation.compose.state.MutableRemoteFloat
import androidx.compose.remote.creation.compose.state.rf
import androidx.compose.runtime.remember
import androidx.wear.compose.remote.material3.RemoteLinearProgressIndicator

val progress = remember { MutableRemoteFloat { 0.25f.rf } }
val toggleAction = valueChange(progress, (progress + 0.25f) % 1f)
// The indicator animates the progress changes.
RemoteLinearProgressIndicator(modifier = modifier.clickable(toggleAction), progress = progress)
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. Progress changes are animated.

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.