Skip to main content

Module media_card

Module media_card 

Expand description

MediaCard and MediaGrid: albums, videos, books, photos, apps.

A media card is the art (a cover, a thumbnail, a photo) with its title and up to two meta lines under it. The art sits in the content with a seated edge and no shadow (only floating things cast one). Overlay badges over the art (a duration, watched progress, a live mark, a downloaded mark) use the floating material, the same as all chrome over media. Under the pointer the card lifts; keyboard focus rings the art in your colour, so the two never look the same.

Art that is not loaded yet, or does not exist, is generated: a smooth neutral gradient with the initials of the title (or of the name an art-only card is seeded with) sized from the tile, or the app’s icon for an app. Art can also be a mosaic of covers (a playlist), the icon of a kind of thing (a podcast, a folder), or painted by the app from theme values. An artist is a circle (MediaAspect::Circle).

MediaGrid reflows cards into columns from the available width, with every row’s text block as tall as its tallest so titles line up, or into justified rows of photos at their own aspect ratios (MediaGrid::justified, justified_rows).

Structs§

MediaCard
A retained media card. See the module docs.
MediaCardFace
Immediate-mode media card.
MediaGrid
A responsive grid of MediaCards. See the module docs.

Enums§

MediaArt
What a card’s art is.
MediaAspect
The shape of a card’s art.
MediaBadge
An overlay mark on the art.
MediaSize
How large the cards of a grid are, in lines of body text so they grow with the text scale.
MediaSource
Where a retained card’s art comes from.
OwnedBadge
Owned badge for the retained card.

Functions§

justified_rows
Lay aspects (width / height) out in justified rows width wide: each row is filled at target_height, then scaled so it spans the width exactly. The last row keeps the target height instead of stretching, capped at the height of the row above it. Returns one rect per item, relative to the origin.

Type Aliases§

ArtPainter
Paints a card’s art into the rect it is given, from theme values.