#[repr(C)]pub struct SafeAreaInsets {
pub top: OptionPixelValue,
pub bottom: OptionPixelValue,
pub left: OptionPixelValue,
pub right: OptionPixelValue,
pub keyboard: OptionPixelValue,
}Expand description
Safe area insets for devices with notches, rounded corners, or sensor housings.
On devices like iPhones with notches or Dynamic Island, the safe area indicates regions where content should not be placed to avoid being obscured by hardware features.
Fields§
§top: OptionPixelValueInset from the top edge (notch, camera housing, etc.)
bottom: OptionPixelValueInset from the bottom edge (home indicator on iPhone)
left: OptionPixelValueInset from the left edge (rounded corners)
right: OptionPixelValueInset from the right edge (rounded corners)
keyboard: OptionPixelValueHow much of the window the on-screen keyboard currently covers, from the bottom edge. APPENDED for ABI stability.
Deliberately NOT folded into bottom. The two have different
lifetimes and different meanings: bottom is the home indicator and is
fixed for the life of the window, while this appears and disappears and
is animated by the OS. An app that adds them together gets the right
answer; one that needs to know why its content shrank cannot recover
that from a single number.
None on desktop and whenever no keyboard is up. Android reports it as
WindowInsets.Type.ime(), iOS as the intersection of
UIKeyboardFrameEndUserInfoKey with the view.
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