class RemoteDp : BaseRemoteState


Represents a Density-independent pixel (Dp) value.

RemoteDp represents a Dp value that can be a constant, a named variable, or a dynamic expression.

Summary

Public companion functions

RemoteDp
createNamedRemoteDp(
    name: String,
    defaultValue: Dp,
    domain: RemoteState.Domain
)

Creates a named RemoteDp with an initial value.

operator RemoteDp
invoke(value: Dp)

Creates a RemoteDp from a literal Dp value.

Public functions

RemoteFloat

Converts a RemoteDp to a RemoteFloat Px using the RemoteDensity.

Public properties

open Dp?

The constant value or null if there isn't one.

Inherited properties

From androidx.compose.remote.creation.compose.state.RemoteState
open Dp

The constant value held by this state.

open Boolean

Whether or not this remote state evaluates to a constant value.

Public companion functions

createNamedRemoteDp

Added in 1.0.0-alpha07
fun createNamedRemoteDp(
    name: String,
    defaultValue: Dp,
    domain: RemoteState.Domain = RemoteState.Domain.User
): RemoteDp

Creates a named RemoteDp with an initial value.

Named remote Dps can be set via AndroidRemoteContext.setNamedFloat.

Parameters
name: String

A unique name to identify this state within its domain.

defaultValue: Dp

The initial Dp value for the named remote Dp.

domain: RemoteState.Domain = RemoteState.Domain.User

The domain for the named state. Defaults to RemoteState.Domain.User.

Returns
RemoteDp

A RemoteDp representing the named Dp.

invoke

Added in 1.0.0-alpha07
operator fun invoke(value: Dp): RemoteDp

Creates a RemoteDp from a literal Dp value.

Parameters
value: Dp

The Dp value.

Returns
RemoteDp

A RemoteDp representing the constant Dp.

Public functions

toPx

Added in 1.0.0-alpha07
fun toPx(): RemoteFloat

Converts a RemoteDp to a RemoteFloat Px using the RemoteDensity.

Public properties

constantValueOrNull

open val constantValueOrNullDp?

The constant value or null if there isn't one.