render/claymorphism/claymorphism_scene library

Claymorphism background scene (BackgroundKind.claySoft): a soft pastel (or night-clay) wash with two matte clay spheres.

BackgroundSpec.colors (nine opaque colours, claymorphism.dart): [0] base, [1] top wash, [2..4] sphere A lit / body / shade, [5..7] sphere B lit / body / shade, [8] the spheres' shadow core. angleTenths is the size balance β (0–750 → sphere A shrinks 10 % while B grows 10 %; foreign angles above 180° read as 0, so a cross-family lerp never jumps).

Arrangement, from the display column S (the text-safe area: toolbar plus display):

  • portrait: sphere A is a cap over S's top-right corner (behind the settings button, wrapping round the card's corner — centred just outside S, so no bar of it runs down beside the card); sphere B sits at the keypad's outer bottom-left corner;
  • landscape (S is ≥ 75 % of the height): A at S's top-left corner, B at the keypad's outer bottom-right corner;
  • gutter (side gutters ≥ 120 dp: side-panel and wide windows): both float in the gutters, fully visible (each radius ≤ half the gutter less claySphereGutterMargin, so neither the sphere nor its shadow is cut by the side panel or the keypad).

No blur at all: the body is one gradient rect, each sphere a radial gradient circle over an elliptical radial-gradient shadow. The scene is static (driftPeriodMs 0) and cached as one picture per (spec, size, text-safe area) in the shared BackgroundCache.

Enums

ClaySceneMode
How the spheres are arranged for a canvas and display column.

Constants

claySphereGutterMargin → const double
In gutter mode each sphere's radius is at most half its gutter less this margin (dp), so the sphere and its shadow fit inside the gutter.
claySphereShadowDrop → const double
A sphere's shadow sits this many radii below its centre…
claySphereShadowSquash → const double
…and is this much flatter than wide (its width is the sphere's).

Functions

claySceneLayout(Size size, Rect? textSafeArea, int angleTenths) → ({ClaySphere a, ClaySphere b, ClaySceneMode mode})
The arrangement of the two spheres on a canvas of size whose display column is textSafeArea (null: the top 36 %).
claySizeBalance(int angleTenths) → double
The size balance β (0–1) of a claySoft scene from its angleTenths.
paintClaymorphismScene(Canvas canvas, Size size, BackgroundScene scene) → void
Paints the Claymorphism scene for scene over the whole canvas.
paintClaySceneBody(Canvas canvas, Size size, BackgroundSpec spec, Rect? textSafeArea) → void
Paints only the scene's body (the top wash fading into the base below the display column) — what the spheres are measured against in tests.

Typedefs

ClaySphere = ({Offset center, double radius})
One sphere of the scene.