Skip to main content

Surfaced

Trait Surfaced 

Source
pub trait Surfaced:
    Styled
    + IntoElement
    + Sized {
    // Provided method
    fn surface(self, theme: &Theme, style: SurfaceStyle) -> Surface { ... }
}
Expand description

The backdrop surfaces, on any element carrying a corner radius.

Provided Methods§

Source

fn surface(self, theme: &Theme, style: SurfaceStyle) -> Surface

Paint this card as liquid glass — SwiftUI’s Glass.clear: a refracting bevel at the rim, a lit edge, and Theme::glass_clear’s dimming.

Blur, bevel and tint all come off Theme, and the shape off the card’s own rounding: the lens dies if any of the three is wrong.

It clears the card’s bg, since the lens paints the fill. Where the lens cannot run — every renderer but macOS Metal — it paints the frosted tint instead, so the surface is never invisible.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§