Skip to main content

paint_card

Function paint_card 

pub fn paint_card(
    scene: &mut Scene,
    transform: Affine,
    text_renderer: &mut TextRenderer,
    theme: &Theme,
    rect: Rect,
    card: &ToastCard<'_>,
) -> ToastCardHit
Expand description

Paint a toast / notification card into rect and return the geometry a caller needs to route clicks. The card is width/height-agnostic (it lays out relative to rect), so a 48px single-line in-app toast and a 64px three-line OS notification share this one renderer.

Layout: soft drop shadow → the floating material + edge → leading severity icon → (optional) attribution caption / title / body text column → (optional) ghost dismiss button → (optional) actionable chevron. Every colour is modulated by card.alpha so the caller drives the enter/exit fade without a second painter.