pub struct Style {Show 21 fields
pub size: Option<Size>,
pub min_size: Option<Size>,
pub max_size: Option<Size>,
pub padding: Insets,
pub gap: f32,
pub flex_grow: f32,
pub flex_shrink: f32,
pub align: Align,
pub justify: Justify,
pub background: Option<Color>,
pub clip: bool,
pub fill: bool,
pub row_height: f32,
pub line_height: Option<f32>,
pub font_size: f32,
pub color: Option<Color>,
pub weight: f32,
pub radius: Radius,
pub border_width: f32,
pub border_color: Option<Color>,
pub shadow: Option<Shadow>,
}Fields§
§size: Option<Size>§min_size: Option<Size>§max_size: Option<Size>§padding: Insets§gap: f32§flex_grow: f32§flex_shrink: f32§align: Align§justify: Justify§background: Option<Color>§clip: bool§fill: boolTakes the whole content box on the parent’s main axis, which is what a scrollback panel or a virtual list wants.
row_height: f32§line_height: Option<f32>Overrides the line box height. None derives it from font_size and
the real font metrics, which is what a view spec wants.
font_size: f32Font size in pixels, used by text renderers for shaping and metrics.
color: Option<Color>§weight: f32§radius: RadiusHow round this box’s corners are. Zero everywhere means a hard rectangle, which is what every view that never mentions radius gets.
border_width: f32Border thickness in pixels, drawn inside the box so it cannot grow it.
border_color: Option<Color>§shadow: Option<Shadow>Drawn behind the box, outside its edges.
Implementations§
Source§impl Style
impl Style
pub fn size(self, size: Size) -> Self
pub fn width(self, value: f32) -> Self
pub fn height(self, value: f32) -> Self
pub fn min_size(self, size: Size) -> Self
pub fn max_size(self, size: Size) -> Self
pub fn padding(self, value: Insets) -> Self
pub fn gap(self, value: f32) -> Self
pub fn flex_grow(self, value: f32) -> Self
pub fn align(self, value: Align) -> Self
pub fn justify(self, value: Justify) -> Self
pub fn background(self, value: Color) -> Self
pub fn clip(self, value: bool) -> Self
pub fn fill(self, value: bool) -> Self
pub fn row_height(self, value: f32) -> Self
Sourcepub fn line_height(self, value: f32) -> Self
pub fn line_height(self, value: f32) -> Self
Pins the line box height instead of deriving it from the font.
pub fn font_size(self, value: f32) -> Self
Sourcepub fn resolved_line_height(&self, font_line_height: f32) -> f32
pub fn resolved_line_height(&self, font_line_height: f32) -> f32
Resolved line box height for a style, given the font’s own line height.
pub fn color(self, value: Color) -> Self
pub fn weight(self, value: f32) -> Self
Sourcepub fn radius(self, value: f32) -> Self
pub fn radius(self, value: f32) -> Self
Rounds the corners by the same amount on every corner, which is what a card, a button or an input wants.
Sourcepub fn radius_sized(self, radius: Radius) -> Self
pub fn radius_sized(self, radius: Radius) -> Self
Rounds each corner size separately, for a panel that is subtly rounded and a popover that is not.
Sourcepub fn border(self, width: f32, color: Color) -> Self
pub fn border(self, width: f32, color: Color) -> Self
Sets the border width and colour together, because a border with no colour is not a border.
pub fn shadow(self, shadow: Shadow) -> Self
Sourcepub fn corner_radius(&self, width: f32, height: f32) -> f32
pub fn corner_radius(&self, width: f32, height: f32) -> f32
The radius this box actually draws with, never more than half its shorter side: a radius wider than the box turns the corners inside out.
Sourcepub fn shadow_reach(&self) -> f32
pub fn shadow_reach(&self) -> f32
How far this box’s shadow reaches past its edges, so a draw that wants to contain the shadow knows how much room to ask for.
Sourcepub fn main_size(&self, axis: Axis) -> Option<f32>
pub fn main_size(&self, axis: Axis) -> Option<f32>
Resolved size along the given axis, if the style pins a non-zero one.
Sourcepub fn cross_size(&self, axis: Axis) -> Option<f32>
pub fn cross_size(&self, axis: Axis) -> Option<f32>
Resolved size across the given axis, if the style pins a non-zero one.