pub struct SwitchStyle {Show 20 fields
pub track_off: Color,
pub track_off_hovered: Color,
pub track_off_pressed: Color,
pub track_on: Color,
pub track_on_hovered: Color,
pub track_on_pressed: Color,
pub thumb: Color,
pub thumb_disabled: Color,
pub border_off: Border,
pub border_on: Border,
pub focus_ring: Border,
pub shadows: Vec<BoxShadow>,
pub width: f32,
pub height: f32,
pub thumb_size: f32,
pub inset: f32,
pub track_radius: f32,
pub thumb_radius: f32,
pub focus_ring_offset: f32,
pub disabled_opacity: f32,
}Expand description
Resolved paint and logical-pixel geometry for a Switch.
§Examples
use ailloli_ui_core::Theme;
use ailloli_ui_widgets::controls::{SwitchSize, SwitchStyle};
let style = SwitchStyle::from_theme(Theme::dark(), SwitchSize::Compact);
assert_eq!((style.width, style.height), (36.0, 20.0));
assert_eq!(style.thumb_size, 14.0);Fields§
§track_off: ColorIdle off-track fill.
track_off_hovered: ColorHovered off-track fill.
track_off_pressed: ColorPressed off-track fill; pressed takes precedence over hover.
track_on: ColorIdle on-track fill.
track_on_hovered: ColorHovered on-track fill.
track_on_pressed: ColorPressed on-track fill; pressed takes precedence over hover.
thumb: ColorEnabled thumb fill.
thumb_disabled: ColorDisabled thumb fill before opacity is applied.
border_off: BorderBorder used while off.
border_on: BorderBorder used while on.
focus_ring: BorderBorder painted outside a focused, enabled switch.
shadows: Vec<BoxShadow>Track shadows painted in vector order.
width: f32Horizontal-orientation intrinsic width in logical pixels.
height: f32Horizontal-orientation intrinsic height in logical pixels.
thumb_size: f32Requested square thumb size in logical pixels.
inset: f32Thumb inset from the off/on end in logical pixels.
track_radius: f32Track corner radius in logical pixels.
thumb_radius: f32Thumb corner radius in logical pixels.
focus_ring_offset: f32Gap from track bounds to focus ring in logical pixels.
disabled_opacity: f32Alpha multiplier applied to disabled paint, normally in 0.0..=1.0.
Implementations§
Source§impl SwitchStyle
impl SwitchStyle
Sourcepub fn from_theme(theme: Theme, size: SwitchSize) -> Self
pub fn from_theme(theme: Theme, size: SwitchSize) -> Self
Resolves colors and geometry for size from theme.
Both built-in sizes use a 3-logical-pixel inset and no shadows.
§Examples
use ailloli_ui_core::Theme;
use ailloli_ui_widgets::controls::{SwitchSize, SwitchStyle};
let style = SwitchStyle::from_theme(Theme::dark(), SwitchSize::Default);
assert_eq!((style.width, style.height), (46.0, 26.0));
assert_eq!(style.inset, 3.0);Trait Implementations§
Source§impl Clone for SwitchStyle
impl Clone for SwitchStyle
Source§fn clone(&self) -> SwitchStyle
fn clone(&self) -> SwitchStyle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SwitchStyle
impl Debug for SwitchStyle
Source§impl Default for SwitchStyle
impl Default for SwitchStyle
Source§impl PartialEq for SwitchStyle
impl PartialEq for SwitchStyle
impl StructuralPartialEq for SwitchStyle
Auto Trait Implementations§
impl Freeze for SwitchStyle
impl RefUnwindSafe for SwitchStyle
impl Send for SwitchStyle
impl Sync for SwitchStyle
impl Unpin for SwitchStyle
impl UnwindSafe for SwitchStyle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.