DiagonalShape class

A shape that creates rectangles with one diagonal edge.

DiagonalShape generates geometric paths for rectangular shapes where one edge is cut diagonally instead of being straight. This creates dynamic, angled layouts commonly used in modern UI designs.

The diagonal cut can be positioned on any of the four sides (top, bottom, left, right) and can slant in either direction (left or right). The angle of the diagonal is customizable and determines how steep the cut appears.

Example usage:

// Create a bottom diagonal with 15-degree angle slanting left
DiagonalShape(
  position: DiagonalPosition.Bottom,
  direction: DiagonalDirection.Left,
  angle: DiagonalAngle.deg(angle: 15),
)

// Create a top diagonal with custom radian angle
DiagonalShape(
  position: DiagonalPosition.Top,
  direction: DiagonalDirection.Right,
  angle: DiagonalAngle.radians(angle: 0.2),
)
Inheritance

Constructors

DiagonalShape.new({DiagonalPosition position = DiagonalPosition.Bottom, DiagonalDirection direction = DiagonalDirection.Left, DiagonalAngle angle = const DiagonalAngle.radians(angle: pi / -20)})
Creates a new DiagonalShape with customizable diagonal properties.

Properties

angle DiagonalAngle
The angle of the diagonal cut.
final
direction DiagonalDirection
The direction the diagonal cut slants.
final
hashCode int
The hash code for this object.
no setterinherited
position DiagonalPosition
The position of the diagonal cut relative to the rectangle.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build({Rect? rect, double? scale}) Path
Builds the geometric path for this diagonal shape.
override
generatePath({required Rect rect}) Path
Generates the actual path for the diagonal shape.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited