byWindow
Picks a per-bucket value. This is the whole object FooDefaults { fun width(w: WindowType) } idiom compressed to one call — the source this came from wrote that when block out longhand thirty-one times across ten files (MovieCardDefaults, BannerDefaults, ButtonDefaults, CastCardDefaults, …), which is why none of those files were worth copying individually and this function is.
object PosterDefaults {
fun width(w: WindowType) = byWindow(w, 100.dp, 140.dp, 160.dp)
fun height(w: WindowType) = byWindow(w, 150.dp, 200.dp, 230.dp)
}Content copied to clipboard
Generic in T, so it carries Dp, TextUnit, Int, Alignment, a lambda — anything that differs by width.
byWindow against the ambient LocalWindowType.