pub struct SafeAreaInsets(/* private fields */);Expand description
The window’s safe area, published by the platform backend.
A backend that knows its device insets — the notch, the status bar, the home
indicator — installs them here once per window and republishes on rotation.
Rust-side layers that the backend cannot inset for itself, such as the
window’s snackbar and overlay hosts, read the value out of the environment
and pad themselves. Backends with no such concept install nothing and
SafeAreaInsets::resolve answers zero, which is the correct answer for a
desktop window.
This does not replace IgnoreSafeArea: that stays the hint a backend reads
to let a view span the full screen, and native chrome containers keep
insetting their own content. SafeAreaInsets exists for the layers WaterUI
lays out itself.
Implementations§
Source§impl SafeAreaInsets
impl SafeAreaInsets
Sourcepub fn new(insets: impl IntoComputed<EdgeInsets>) -> Self
pub fn new(insets: impl IntoComputed<EdgeInsets>) -> Self
Wraps a reactive inset signal.
Sourcepub const fn signal(&self) -> &Computed<EdgeInsets>
pub const fn signal(&self) -> &Computed<EdgeInsets>
The reactive insets carried by this scope.
Sourcepub fn resolve(env: &Environment) -> Computed<EdgeInsets>
pub fn resolve(env: &Environment) -> Computed<EdgeInsets>
The insets in force at this position, or zero when no backend published any.
Sourcepub fn resolve_with_margin(
env: &Environment,
margin: EdgeInsets,
) -> Computed<EdgeInsets>
pub fn resolve_with_margin( env: &Environment, margin: EdgeInsets, ) -> Computed<EdgeInsets>
The insets in force at this position plus a constant margin.
This is what an overlay layer wants: clear of the hardware, and then clear of the window edge by the theme’s own spacing.
Sourcepub fn install(env: &mut Environment, insets: impl IntoComputed<EdgeInsets>)
pub fn install(env: &mut Environment, insets: impl IntoComputed<EdgeInsets>)
Publishes insets to the subtree rendered from env.
Trait Implementations§
Source§impl Clone for SafeAreaInsets
impl Clone for SafeAreaInsets
Source§fn clone(&self) -> SafeAreaInsets
fn clone(&self) -> SafeAreaInsets
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more