pub trait Glass:
Styled
+ IntoElement
+ Sized {
// Provided methods
fn material(self, blur_radius: f32) -> Material { ... }
fn glass_effect(self) -> Material { ... }
}Expand description
The backdrop surfaces, on any element carrying a corner radius.
Provided Methods§
Sourcefn material(self, blur_radius: f32) -> Material
fn material(self, blur_radius: f32) -> Material
Frost this card at the corner radius it already carries.
The radius comes off the element’s own style, so a caller chaining its
own rounding — card.rounded(px(4.0)).material(MENU_BLUR) — gets a blur
cut to the corners it just asked for.
Sourcefn glass_effect(self) -> Material
fn glass_effect(self) -> Material
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".