A shadow needs a shape, and Compose won't guess one for you
Drawing custom shapes means Path plus DrawScope. Shadows are separate, and Modifier.shadow takes its own shape parameter — omitting it is why rounded cards get square shadows.
We use Google Analytics to see which pages help people. No ads, no profiles. Privacy Policy
118 posts
Drawing custom shapes means Path plus DrawScope. Shadows are separate, and Modifier.shadow takes its own shape parameter — omitting it is why rounded cards get square shadows.
Compose gradients take pixel coordinates, so a hardcoded end point produces a different result on every screen size. Float.POSITIVE_INFINITY and DrawScope.size are the two ways to make a brush relative.
Painter draws content and declares an intrinsic size, which is what lets it participate in layout the way a resource does. Writing one is the right answer when drawing needs to be reusable across Image, Icon and modifiers.
ImageVector is drawing commands executed at render time; ImageBitmap is pixels held in memory. The choice is about scaling fidelity versus per-frame cost, and the common mistakes run in both directions.
One measurement pass means a child cannot ask its parent how big it is.
Image sizing depends on the modifier constraints and contentScale together. Understanding which one crops, which one fits, and where the aspect ratio comes from resolves most image layout bugs in one pass.
It is scoped to a composition and keyed by its arguments. A missing key gives stale state; a wrong one recomputes every frame.
Keyed to Unit means once per composition entry — not once per screen visit, and not once per user.
Compose's autofill is a semantics property on a text field. Declaring content types lets password managers and the platform fill forms correctly, and omitting it is why users abandon sign-up.
Without a key, item identity is positional — so an insert at the top reuses every slot's state for the wrong item.
padding then clickable gives a different touch target from clickable then padding — and both look identical.
Compose re-executes functions whose inputs changed. An unstable parameter means all of them.