pub struct SafeAreaInsets {
pub top: i16,
pub right: i16,
pub bottom: i16,
pub left: i16,
}Expand description
移动端与异形屏安全区域内边距(状态栏、刘海屏/灵动岛、圆角边缘与底部 Home Indicator)。
Fields§
§top: i16§right: i16§bottom: i16§left: i16Implementations§
Source§impl SafeAreaInsets
impl SafeAreaInsets
Sourcepub const fn new(top: i16, right: i16, bottom: i16, left: i16) -> Self
pub const fn new(top: i16, right: i16, bottom: i16, left: i16) -> Self
创建四向安全区域内边距 (top, right, bottom, left)。
Sourcepub const fn phone_portrait() -> Self
pub const fn phone_portrait() -> Self
常见全面屏手机竖屏默认安全区域(顶部状态栏/灵动岛 44px,底部 Home Indicator 34px)。
Sourcepub const fn phone_landscape() -> Self
pub const fn phone_landscape() -> Self
常见全面屏手机横屏默认安全区域(左右异形区 44px,底部 Home Indicator 21px)。
Sourcepub const fn android_portrait() -> Self
pub const fn android_portrait() -> Self
Android 全面屏手机竖屏默认安全区域(状态栏/挖孔屏 48px,底部手势导航条 34px)。
Sourcepub const fn android_landscape() -> Self
pub const fn android_landscape() -> Self
Android 全面屏手机横屏默认安全区域(左侧挖孔区 48px,底部手势横条 24px)。
Sourcepub const fn ios_portrait() -> Self
pub const fn ios_portrait() -> Self
iOS (iPhone 灵动岛/全面屏) 竖屏默认安全区域(顶部灵动岛 59pt,底部 Home Indicator 34pt)。
Sourcepub const fn ios_landscape() -> Self
pub const fn ios_landscape() -> Self
iOS (iPhone 灵动岛/全面屏) 横屏默认安全区域(左右安全区 59pt,底部 Home Indicator 21pt)。
Sourcepub const fn harmony_portrait() -> Self
pub const fn harmony_portrait() -> Self
鸿蒙 (HarmonyOS NEXT / OpenHarmony) 手机竖屏默认避让区域(顶部状态栏 38vp,底部导航条 28vp)。
Sourcepub const fn harmony_landscape() -> Self
pub const fn harmony_landscape() -> Self
鸿蒙 (HarmonyOS NEXT / OpenHarmony) 手机横屏默认避让区域(左右避让区 38vp,底部导航条 20vp)。
Trait Implementations§
Source§impl Clone for SafeAreaInsets
impl Clone for SafeAreaInsets
impl Copy for SafeAreaInsets
Source§impl Debug for SafeAreaInsets
impl Debug for SafeAreaInsets
Source§impl Default for SafeAreaInsets
impl Default for SafeAreaInsets
impl Eq for SafeAreaInsets
Source§impl PartialEq for SafeAreaInsets
impl PartialEq for SafeAreaInsets
impl StructuralPartialEq for SafeAreaInsets
Auto Trait Implementations§
impl Forget for SafeAreaInsets
impl Freeze for SafeAreaInsets
impl Move for SafeAreaInsets
impl RefUnwindSafe for SafeAreaInsets
impl Send for SafeAreaInsets
impl Sync for SafeAreaInsets
impl Unpin for SafeAreaInsets
impl UnsafeUnpin for SafeAreaInsets
impl UnwindSafe for SafeAreaInsets
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。