#[non_exhaustive]pub struct Style {Show 18 fields
pub font: Option<Font>,
pub size: Option<Bindable<f64>>,
pub weight: Option<Bindable<FontWeight>>,
pub design: Option<FontDesign>,
pub font_family: Option<String>,
pub monospaced_digit: Option<bool>,
pub color: Option<Bindable<Color>>,
pub line_limit: Option<u8>,
pub minimum_scale_factor: Option<f64>,
pub alignment: Option<HorizontalAlignment>,
pub padding: Option<Padding>,
pub frame: Option<Frame>,
pub background: Option<Bindable<Color>>,
pub corner_radius: Option<Bindable<f64>>,
pub opacity: Option<Bindable<f64>>,
pub tint: Option<Bindable<Color>>,
pub button_style: Option<ButtonStyle>,
pub content_transition: Option<ContentTransition>,
}Expand description
Modifiers a node takes through its style token. At least one member; font and size
exclude each other, and so do font_family and design. The Bindable members may name a value instead of a literal; the
others are fixed at start.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.font: Option<Font>§size: Option<Bindable<f64>>Font size in points.
weight: Option<Bindable<FontWeight>>§design: Option<FontDesign>§font_family: Option<String>The PostScript or family name of a font that the widget extension bundles (listed under
UIAppFonts in its Info.plist). With font it takes that text style’s size, with size that
size; not together with design. A name the extension lacks draws the system font.
monospaced_digit: Option<bool>§color: Option<Bindable<Color>>Foreground color.
line_limit: Option<u8>§minimum_scale_factor: Option<f64>§alignment: Option<HorizontalAlignment>Alignment of text that spans several lines.
padding: Option<Padding>§frame: Option<Frame>§background: Option<Bindable<Color>>§corner_radius: Option<Bindable<f64>>§opacity: Option<Bindable<f64>>§tint: Option<Bindable<Color>>Tint of buttons, toggles, progress views and gauges.
content_transition: Option<ContentTransition>How text and symbols change when their value does.
Implementations§
Source§impl Style
impl Style
pub fn new() -> Style
pub fn weight(self, weight: impl Into<Bindable<FontWeight>>) -> Style
Sourcepub fn design(self, design: FontDesign) -> Style
pub fn design(self, design: FontDesign) -> Style
Not together with font_family.
Sourcepub fn font_family(self, name: impl Into<String>) -> Style
pub fn font_family(self, name: impl Into<String>) -> Style
A font that the widget extension bundles, by its PostScript or family name.
Sourcepub fn monospaced_digit(self) -> Style
pub fn monospaced_digit(self) -> Style
Digits of equal width.
Sourcepub fn line_limit(self, lines: u8) -> Style
pub fn line_limit(self, lines: u8) -> Style
At most this many lines, 1 to 10.
Sourcepub fn minimum_scale_factor(self, factor: f64) -> Style
pub fn minimum_scale_factor(self, factor: f64) -> Style
How far text may shrink to fit, 0.1 to 1.
Sourcepub fn alignment(self, alignment: HorizontalAlignment) -> Style
pub fn alignment(self, alignment: HorizontalAlignment) -> Style
The alignment of text that spans several lines.
Sourcepub fn padding(self, padding: impl Into<Padding>) -> Style
pub fn padding(self, padding: impl Into<Padding>) -> Style
One number for every edge, or [top, leading, bottom, trailing], each 0 to 64 points.
pub fn frame(self, frame: Frame) -> Style
pub fn background(self, color: impl Into<Bindable<Color>>) -> Style
Sourcepub fn tint(self, color: impl Into<Bindable<Color>>) -> Style
pub fn tint(self, color: impl Into<Bindable<Color>>) -> Style
The tint of buttons, progress bars and gauges.
Sourcepub fn content_transition(self, transition: ContentTransition) -> Style
pub fn content_transition(self, transition: ContentTransition) -> Style
How text and symbols with this style change when an update gives them another value.