pub struct PatchBuilder { /* private fields */ }Expand description
Builds a StylePatch with the same setters the element builders have,
for static values only.
A variant method such as hover hands a
fresh builder to the closure the caller passes and takes the builder back
when the closure returns it, so a patch reads as a chain:
|p| p.background(color).border(1.0).
Implementations§
Source§impl PatchBuilder
impl PatchBuilder
Sourcepub fn size(self, size: Size) -> Self
pub fn size(self, size: Size) -> Self
Sets the width and the height, in logical pixels. This takes part in layout.
Sourcepub fn min_width(self, width: Length) -> Self
pub fn min_width(self, width: Length) -> Self
Sets the lower bound of the width. This takes part in layout.
Sourcepub fn min_height(self, height: Length) -> Self
pub fn min_height(self, height: Length) -> Self
Sets the lower bound of the height. This takes part in layout.
Sourcepub fn max_width(self, width: Length) -> Self
pub fn max_width(self, width: Length) -> Self
Sets the upper bound of the width. This takes part in layout.
Sourcepub fn max_height(self, height: Length) -> Self
pub fn max_height(self, height: Length) -> Self
Sets the upper bound of the height. This takes part in layout.
Sourcepub fn padding(self, padding: Length) -> Self
pub fn padding(self, padding: Length) -> Self
Sets the same padding on all four sides. This takes part in layout.
Sourcepub fn padding_xy(self, padding: Size) -> Self
pub fn padding_xy(self, padding: Size) -> Self
Sets the horizontal padding from width and the vertical padding from
height. This takes part in layout.
Sourcepub fn margin(self, margin: Length) -> Self
pub fn margin(self, margin: Length) -> Self
Sets the same margin on all four sides. This takes part in layout.
Sourcepub fn gap(self, gap: Size) -> Self
pub fn gap(self, gap: Size) -> Self
Sets the space between adjacent children. This takes part in layout.
Sourcepub fn direction(self, direction: Direction) -> Self
pub fn direction(self, direction: Direction) -> Self
Sets the main axis of the children’s layout. This takes part in layout.
Sourcepub fn wrap(self, wrap: bool) -> Self
pub fn wrap(self, wrap: bool) -> Self
Lets children that do not fit move to a new line instead of shrinking. This takes part in layout.
Sourcepub fn grow(self, grow: f32) -> Self
pub fn grow(self, grow: f32) -> Self
Sets the share of the leftover space on the main axis this node takes. This takes part in layout.
Sourcepub fn shrink(self, shrink: f32) -> Self
pub fn shrink(self, shrink: f32) -> Self
Sets how readily this node gives up space when its siblings overflow. This takes part in layout.
Sourcepub fn basis(self, basis: Length) -> Self
pub fn basis(self, basis: Length) -> Self
Sets the main axis size the node starts from before growing or shrinking. This takes part in layout.
Sourcepub fn align_items(self, align: Align) -> Self
pub fn align_items(self, align: Align) -> Self
Sets how the children line up across the main axis. This takes part in layout.
Sourcepub fn justify_content(self, justify: Justify) -> Self
pub fn justify_content(self, justify: Justify) -> Self
Sets how the children are spread along the main axis. This takes part in layout.
Sourcepub fn absolute(self) -> Self
pub fn absolute(self) -> Self
Takes the node out of normal flow, so its insets place it against its containing block. This takes part in layout.
Sourcepub fn inset(self, inset: Edges<Length>) -> Self
pub fn inset(self, inset: Edges<Length>) -> Self
Sets the offsets from the containing block’s edges. This takes part in layout.
Sourcepub fn border(self, width: f32) -> Self
pub fn border(self, width: f32) -> Self
Sets the border width, the same on all four sides. This takes part in layout, because the border takes space away from the content.
Sourcepub fn clip(self, clip: bool) -> Self
pub fn clip(self, clip: bool) -> Self
Clips the children to the node’s bounds. This takes part in layout.
Hides the node and its subtree, or shows them again. This takes part in layout.
Sourcepub fn background(self, color: impl Into<ColorValue>) -> Self
pub fn background(self, color: impl Into<ColorValue>) -> Self
Sets the fill painted behind the node.
The color can be a Color or a
ColorToken. A token resolves against the
theme that is current when the node paints.
Sourcepub fn border_color(self, color: impl Into<ColorValue>) -> Self
pub fn border_color(self, color: impl Into<ColorValue>) -> Self
Sets the color of the border whose width PatchBuilder::border
sets.
The color can be a Color or a
ColorToken. A token resolves against the
theme that is current when the node paints.
Sourcepub fn text_color(self, color: impl Into<ColorValue>) -> Self
pub fn text_color(self, color: impl Into<ColorValue>) -> Self
Sets the color a widget’s text paints with.
Widgets that show text read it; widgets without text ignore it. The
color can be a Color or a
ColorToken. A token resolves against the
theme that is current when the node paints.
Sourcepub fn corner_radius(self, radius: impl Into<RadiusValue>) -> Self
pub fn corner_radius(self, radius: impl Into<RadiusValue>) -> Self
Sets the corner radius of the background and the border, the same on all four corners.
The radius can be an f32 or a
RadiusToken. A token resolves against
the theme that is current when the node paints.