BorderDirectional class

A border of a box, comprised of four sides, the lateral sides of which flip over based on the reading direction.

The lateral sides are called start and end. When painted in left-to-right environments, the start side will be painted on the left and the end side on the right; in right-to-left environments, it is the reverse. The other two sides are top and bottom.

The sides are represented by BorderSide objects.

If the start and end sides are the same, then it is slightly more efficient to use a Border object rather than a BorderDirectional object.

See also:

  • BoxDecoration, which uses this class to describe its edge decoration.
  • BorderSide, which is used to describe each side of the box.
  • Theme, from the material layer, which can be queried to obtain appropriate colors to use for borders in a MaterialApp, as shown in the "divider" sample above.
  •, a package that implements a Non-Uniform Border on ShapeBorder, which is used by Material Design buttons and other widgets, under the "shape" field.


BorderDirectional({BorderSide top = BorderSide.none, BorderSide start = BorderSide.none, BorderSide end = BorderSide.none, BorderSide bottom = BorderSide.none})
Creates a border.


bottom BorderSide
The bottom side of this border.
dimensions EdgeInsetsGeometry
The widths of the sides of this border represented as an EdgeInsets.
no setteroverride
end BorderSide
The end side of this border.
hashCode int
The hash code for this object.
no setteroverride
isUniform bool
Whether all four sides of the border are identical. Uniform borders are typically more efficient to paint.
no setteroverride
preferPaintInterior bool
Reports whether paintInterior is implemented.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
start BorderSide
The start side of this border.
top BorderSide
The top side of this border.


add(ShapeBorder other, {bool reversed = false}) BoxBorder?
Attempts to create a new object that represents the amalgamation of this border and the other border.
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, BoxShape shape = BoxShape.rectangle, BorderRadius? borderRadius}) → 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) BorderDirectional
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.

Static Methods

lerp(BorderDirectional? a, BorderDirectional? b, double t) BorderDirectional?
Linearly interpolate between two borders.
merge(BorderDirectional a, BorderDirectional b) BorderDirectional
Creates a BorderDirectional that represents the addition of the two given BorderDirectionals.