pub enum ShapeBorder {
RoundedRectangle {
radius: BorderRadius,
side: BorderSide,
},
Stadium {
side: BorderSide,
},
Circle {
eccentricity: f32,
side: BorderSide,
},
Beveled {
radius: BorderRadius,
side: BorderSide,
},
}Expand description
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>) -> Self
pub fn rounded(radius: impl Into<BorderRadius>) -> Self
A rectangle with these corners and no edge.
Sourcepub fn beveled(radius: impl Into<BorderRadius>) -> Self
pub fn beveled(radius: impl Into<BorderRadius>) -> Self
A rectangle with these corners cut off straight, and no edge.
Sourcepub fn with_side(self, side: BorderSide) -> Self
pub fn with_side(self, side: BorderSide) -> Self
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.