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.
link

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.
Inheritance

Constructors

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.
const
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.
const

Properties

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.
final
points double
The number of points in this star, or sides on a polygon.
final
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.
finalinherited
squash double
How much of the aspect ratio of the attached widget to take on.
final
valleyRounding double
The amount of rounding of the interior corners of stars.
final

Methods

add(ShapeBorder other, {bool reversed = false}) ShapeBorder?
Attempts to create a new object that represents the amalgamation of this border and the other border.
inherited
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.
override
getInnerPath(Rect rect, {TextDirection? textDirection}) Path
Create a Path that describes the inner edge of the border.
override
getOuterPath(Rect rect, {TextDirection? textDirection}) Path
Create a Path that describes the outer edge of the border.
override
lerpFrom(ShapeBorder? a, double t) ShapeBorder?
Linearly interpolates from another ShapeBorder (possibly of another class) to this.
override
lerpTo(ShapeBorder? b, double t) ShapeBorder?
Linearly interpolates from this to another ShapeBorder (possibly of another class).
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(Canvas canvas, Rect rect, {TextDirection? textDirection}) → void
Paints the border within the given Rect on the given Canvas.
override
paintInterior(Canvas canvas, Rect rect, Paint paint, {TextDirection? textDirection}) → void
Paint a canvas with the appropriate shape.
inherited
scale(double t) ShapeBorder
Creates a copy of this border, scaled by the factor t.
override
toString() String
A string representation of this object.
override

Operators

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