StarBorder class

A border that fits a star or polygon-shaped border within the rectangle of the widget it is applied to.

Typically used with a ShapeDecoration to draw a polygonal or star shaped border.

This example serves both as a usage example, as well as an explorer for determining the parameters to use with a StarBorder. The resulting code can be copied and pasted into your app. A Container is just one widget which takes a ShapeBorder. Dialogs, OutlinedButtons, ElevatedButtons, etc. all can be shaped with a ShapeBorder.

To create a local project with this code sample, run:
flutter create --sample=painting.StarBorder.1 mysample

See also:

  • BorderSide, which is used to describe how the edge of the shape is drawn.


StarBorder({BorderSide side = BorderSide.none, double points = 5, double innerRadiusRatio = 0.4, double pointRounding = 0, double valleyRounding = 0, double rotation = 0, double squash = 0})
Create a const star-shaped border with the given number points on the star.
StarBorder.polygon({BorderSide side = BorderSide.none, double sides = 5, double pointRounding = 0, double rotation = 0, double squash = 0})
Create a const polygon border with the given number of sides.


dimensions EdgeInsetsGeometry
The widths of the sides of this border represented as an EdgeInsets.
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
innerRadiusRatio double
The ratio of the inner radius of a star with the outer radius.
no setter
pointRounding double
The amount of rounding on the points of stars, or the corners of polygons.
points double
The number of points in this star, or sides on a polygon.
preferPaintInterior bool
Reports whether paintInterior is implemented.
no setterinherited
rotation double
The rotation in clockwise degrees around the center of the shape.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
side BorderSide
The border outline's color and weight.
squash double
How much of the aspect ratio of the attached widget to take on.
valleyRounding double
The amount of rounding of the interior corners of stars.


add(ShapeBorder other, {bool reversed = false}) ShapeBorder?
Attempts to create a new object that represents the amalgamation of this border and the other border.
copyWith({BorderSide? side, double? points, double? innerRadiusRatio, double? pointRounding, double? valleyRounding, double? rotation, double? squash}) StarBorder
Returns a copy of this OutlinedBorder that draws its outline with the specified side, if side is non-null.
getInnerPath(Rect rect, {TextDirection? textDirection}) Path
Create a Path that describes the inner edge of the border.
getOuterPath(Rect rect, {TextDirection? textDirection}) Path
Create a Path that describes the outer edge of the border.
lerpFrom(ShapeBorder? a, double t) ShapeBorder?
Linearly interpolates from another ShapeBorder (possibly of another class) to this.
lerpTo(ShapeBorder? b, double t) ShapeBorder?
Linearly interpolates from this to another ShapeBorder (possibly of another class).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) → void
Paints the border within the given Rect on the given Canvas.
paintInterior(Canvas canvas, Rect rect, Paint paint, {TextDirection? textDirection}) → void
Paint a canvas with the appropriate shape.
scale(double t) ShapeBorder
Creates a copy of this border, scaled by the factor t.
toString() String
A string representation of this object.


operator +(ShapeBorder other) ShapeBorder
Creates a new border consisting of the two borders on either side of the operator.
operator ==(Object other) bool
The equality operator.