byFormFactor
fun <T> byFormFactor(formFactor: FormFactor, default: T, watch: T = default, handheld: T = default, desktop: T = default, tv: T = default): T
Picks a per-surface value, overriding only the surfaces that actually differ.
Most components need one value everywhere and one exception — a poster that must be bigger on a television, a control that must be smaller on a wrist. Spelling out four branches to change one of them is how the source ended up with a second, fully duplicated token system for TV.
val posterWidth = byFormFactor(default = 140.dp, watch = 64.dp, tv = 220.dp)Content copied to clipboard
fun <T> byFormFactor(default: T, watch: T = default, handheld: T = default, desktop: T = default, tv: T = default): T
byFormFactor against the ambient LocalFormFactor.