RoundedPolygon.rectangle constructor

RoundedPolygon.rectangle({
  1. double width = 2.0,
  2. double height = 2.0,
  3. CornerRounding rounding = .unrounded,
  4. List<CornerRounding>? perVertexRounding,
  5. double centerX = 0.0,
  6. double centerY = 0.0,
})

Implementation

factory RoundedPolygon.rectangle({
  double width = 2.0,
  double height = 2.0,
  CornerRounding rounding = .unrounded,
  List<CornerRounding>? perVertexRounding,
  double centerX = 0.0,
  double centerY = 0.0,
}) {
  final left = centerX - width / 2.0;
  final top = centerY - height / 2.0;
  final right = centerX + width / 2.0;
  final bottom = centerY + height / 2.0;

  return .fromVertices(
    vertices: [right, bottom, left, bottom, left, top, right, top],
    rounding: rounding,
    perVertexRounding: perVertexRounding,
    centerX: centerX,
    centerY: centerY,
  );
}