pub struct BadgeStyle {Show 17 fields
pub background: Background,
pub border: Border,
pub radius: Radius,
pub shadows: Vec<BoxShadow>,
pub text: TextStyle,
pub count_text: TextStyle,
pub icon_tint: Color,
pub dot_color: Color,
pub close_tint: Color,
pub height: f32,
pub padding_x: f32,
pub gap: f32,
pub icon_size: f32,
pub dot_size: f32,
pub close_size: f32,
pub baseline_shift: f32,
pub disabled_opacity: f32,
}Expand description
Resolved visual and logical-pixel geometry for pill controls.
Colors are derived from the selected tone and variant. Geometry is not validated: negative or non-finite custom values propagate into layout and paint calculations.
§Examples
use ailloli_ui_core::Theme;
use ailloli_ui_widgets::controls::{BadgeStyle, BadgeTone, BadgeVariant};
let style = BadgeStyle::from_theme(Theme::dark(), BadgeTone::Info, BadgeVariant::Soft);
assert_eq!((style.height, style.padding_x, style.icon_size), (26.0, 9.0, 14.0));Fields§
§background: BackgroundPill fill; the painter currently supports color backgrounds.
border: BorderPer-edge border widths and colors.
radius: RadiusCorner radii used by the fill, border, and shadows.
shadows: Vec<BoxShadow>Painted shadows; unlike popup helpers, inset shadows are not filtered.
text: TextStyleLabel text style.
count_text: TextStyleNumeric count text style.
icon_tint: ColorTint for an optional leading icon.
dot_color: ColorFill for an optional leading dot.
close_tint: ColorTint for a chip’s close icon.
height: f32Preferred pill height in logical pixels; text can make it taller.
padding_x: f32Horizontal inset on each side in logical pixels.
gap: f32Horizontal spacing between content segments in logical pixels.
icon_size: f32Leading icon width and height in logical pixels.
dot_size: f32Leading dot diameter in logical pixels.
close_size: f32Close icon width and height in logical pixels.
baseline_shift: f32Reserved baseline offset; the current painter does not read this field.
disabled_opacity: f32Alpha multiplier applied when a chip is disabled.
Implementations§
Source§impl BadgeStyle
impl BadgeStyle
Sourcepub fn from_theme(theme: Theme, tone: BadgeTone, variant: BadgeVariant) -> Self
pub fn from_theme(theme: Theme, tone: BadgeTone, variant: BadgeVariant) -> Self
Resolves badge/chip colors and default geometry from a theme.
The result is 26 logical pixels high with 9-pixel horizontal padding.
§Examples
use ailloli_ui_core::Theme;
use ailloli_ui_widgets::controls::{BadgeStyle, BadgeTone, BadgeVariant};
let style = BadgeStyle::from_theme(
Theme::default(),
BadgeTone::Success,
BadgeVariant::Filled,
);
assert_eq!(style.height, 26.0);
assert_eq!(style.disabled_opacity, 0.45);Sourcepub fn tag_from_theme(
theme: Theme,
tone: BadgeTone,
variant: BadgeVariant,
) -> Self
pub fn tag_from_theme( theme: Theme, tone: BadgeTone, variant: BadgeVariant, ) -> Self
Resolves the shorter tag geometry from a theme.
This starts from Self::from_theme and changes the height to 24
logical pixels and horizontal padding to 8 logical pixels.
§Examples
use ailloli_ui_core::Theme;
use ailloli_ui_widgets::controls::{BadgeStyle, BadgeTone, BadgeVariant};
let style = BadgeStyle::tag_from_theme(
Theme::default(),
BadgeTone::Neutral,
BadgeVariant::Outline,
);
assert_eq!((style.height, style.padding_x), (24.0, 8.0));Trait Implementations§
Source§impl Clone for BadgeStyle
impl Clone for BadgeStyle
Source§fn clone(&self) -> BadgeStyle
fn clone(&self) -> BadgeStyle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BadgeStyle
impl Debug for BadgeStyle
Source§impl Default for BadgeStyle
impl Default for BadgeStyle
Source§impl PartialEq for BadgeStyle
impl PartialEq for BadgeStyle
impl StructuralPartialEq for BadgeStyle
Auto Trait Implementations§
impl Freeze for BadgeStyle
impl RefUnwindSafe for BadgeStyle
impl Send for BadgeStyle
impl Sync for BadgeStyle
impl Unpin for BadgeStyle
impl UnwindSafe for BadgeStyle
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.