ScreenSize

class ScreenSize(val width: Dp, val height: Dp, val label: String = "x")

Represents a screen size with width and height in density-independent pixels

Encapsulates screen dimensions for different device types, providing common presets for smartphones, tablets, and desktop displays. Used primarily in ScreenSizeField for responsive design testing and preview environments.

// Create custom screen size
val customSize = ScreenSize(width = 400.dp, height = 800.dp, label = "Custom Phone")

// Use predefined presets
val phone = ScreenSize.MediumSmartPhone
val tablet = ScreenSize.LargeTablet
val desktop = ScreenSize.MediumDesktop

// Create landscape version
val landscapePhone = ScreenSize.MediumSmartPhone.reversed()

Parameters

width

Screen width in dp

height

Screen height in dp

label

Display name for UI selection (auto-generated if not provided)

See also

Constructors

Link copied to clipboard
constructor(width: Dp, height: Dp, label: String = "x")

Types

Link copied to clipboard
object Companion

Common device size presets for testing responsive designs

Properties

Link copied to clipboard
val height: Dp
Link copied to clipboard
Link copied to clipboard
val width: Dp

Functions

Link copied to clipboard

Creates a landscape orientation of this screen size