pub enum ShapeBorder {
RoundedRectangle {
radius: BorderRadius,
side: BorderSide,
},
Stadium {
side: BorderSide,
},
Circle {
eccentricity: f32,
side: BorderSide,
},
Beveled {
radius: BorderRadius,
side: BorderSide,
},
}Expand description
What a decoration is made of — its shape, its sides, its border’s two forms, its
shadows’ blur — and the shapes a border can take.
What shape a box is (shape_border.dart), and the edge around it.
Copy, deliberately: this is meant to sit in a theme, and the theme’s per-widget
structs are copied wholesale. A shape with a variable number of corners — the
reference’s StarBorder, LinearBorder — would end that, and is not here.
Variants§
RoundedRectangle
Corners rounded by a radius each (rounded_rectangle_border.dart).
Stadium
A pill: the ends are semicircles, whatever the box’s proportions
(stadium_border.dart:95). What a chip is, and what a navigation indicator is.
Fields
side: BorderSideThe edge drawn around the shape.
Circle
A circle inscribed in the box, or an ellipse on the way to filling it
(circle_border.dart:126).
Fields
eccentricity: f320.0 — a true circle, in a square taken out of the middle of the box. 1.0 —
an ellipse filling the box entirely. Between them, the circle grows towards
the ellipse along the box’s longer axis.
side: BorderSideThe edge drawn around the shape.
Beveled
Corners cut off straight rather than rounded
(beveled_rectangle_border.dart). The one shape here that is not a rounded
rectangle in disguise.
Fields
radius: BorderRadiusThe corner radii, before bevelling.
side: BorderSideThe edge drawn around the shape.
Implementations§
Source§impl ShapeBorder
impl ShapeBorder
Sourcepub fn rounded(radius: impl Into<BorderRadius>) -> ShapeBorder
pub fn rounded(radius: impl Into<BorderRadius>) -> ShapeBorder
A rectangle with these corners and no edge.
Sourcepub const fn stadium() -> ShapeBorder
pub const fn stadium() -> ShapeBorder
A pill with no edge.
Sourcepub const fn circle() -> ShapeBorder
pub const fn circle() -> ShapeBorder
A circle with no edge.
Sourcepub fn beveled(radius: impl Into<BorderRadius>) -> ShapeBorder
pub fn beveled(radius: impl Into<BorderRadius>) -> ShapeBorder
A rectangle with these corners cut off straight, and no edge.
Sourcepub fn with_side(self, side: BorderSide) -> ShapeBorder
pub fn with_side(self, side: BorderSide) -> ShapeBorder
The same shape with an edge around it (the reference’s copyWith(side:)).
Sourcepub fn side(&self) -> BorderSide
pub fn side(&self) -> BorderSide
The edge around it.
Sourcepub fn as_rounded(&self, rect: Rect) -> Option<(Rect, BorderRadius)>
pub fn as_rounded(&self, rect: Rect) -> Option<(Rect, BorderRadius)>
The rounded rectangle this shape is inside rect: the box to draw and the
radii to draw it with — or None when the outline is not one and wants
outline.
A stadium’s radius is half its short side (stadium_border.dart:95); a circle’s
box is the one _adjustRect takes out of the middle (circle_border.dart:126),
with half its short side. Saying it this way is what keeps three shapes out of
the path renderer.
Trait Implementations§
Source§impl Clone for ShapeBorder
impl Clone for ShapeBorder
Source§fn clone(&self) -> ShapeBorder
fn clone(&self) -> ShapeBorder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more