Polygon<R extends Object> constructor

Polygon<R extends Object>({
  1. required List<LatLng> points,
  2. List<List<LatLng>>? holePointsList,
  3. Color? color,
  4. double borderStrokeWidth = 0,
  5. Color borderColor = const Color(0xFFFFFF00),
  6. bool disableHolesBorder = false,
  7. StrokePattern pattern = const StrokePattern.solid(),
  8. StrokeCap strokeCap = StrokeCap.round,
  9. StrokeJoin strokeJoin = StrokeJoin.round,
  10. String? label,
  11. TextStyle labelStyle = const TextStyle(),
  12. @Deprecated('Use `labelPlacementCalculator` with the equivalent calculator instead. ' 'Then, remove any arguments to this parameter and allow it to default. ' 'This enables more flexibility and extensibility. ' 'This was deprecated after v8.2.0, and will be removed in a future ' 'version.') PolygonLabelPlacement labelPlacement = PolygonLabelPlacement.centroid,
  13. PolygonLabelPlacementCalculator? labelPlacementCalculator,
  14. bool rotateLabel = false,
  15. R? hitValue,
})

Create a new Polygon instance by setting it's parameters.

Implementation

Polygon({
  required this.points,
  this.holePointsList,
  this.color,
  this.borderStrokeWidth = 0,
  this.borderColor = const Color(0xFFFFFF00),
  this.disableHolesBorder = false,
  this.pattern = const StrokePattern.solid(),
  this.strokeCap = StrokeCap.round,
  this.strokeJoin = StrokeJoin.round,
  this.label,
  this.labelStyle = const TextStyle(),
  // TODO: Remove `labelPlacement`, and make `labelPlacementCalculator`
  // `this.` with default, then remove initialiser list
  @Deprecated(
    'Use `labelPlacementCalculator` with the equivalent calculator instead. '
    'Then, remove any arguments to this parameter and allow it to default. '
    'This enables more flexibility and extensibility. '
    'This was deprecated after v8.2.0, and will be removed in a future '
    'version.',
  )
  this.labelPlacement = PolygonLabelPlacement.centroid,

  /// See [labelPlacementCalculator]
  PolygonLabelPlacementCalculator? labelPlacementCalculator,
  this.rotateLabel = false,
  this.hitValue,
})  : _filledAndClockwise = color != null && isClockwise(points),
      labelPlacementCalculator = labelPlacementCalculator ??
          switch (labelPlacement) {
            // ignore: deprecated_member_use_from_same_package
            PolygonLabelPlacement.centroid =>
              const PolygonLabelPlacementCalculator.centroid(),
            // ignore: deprecated_member_use_from_same_package
            PolygonLabelPlacement.centroidWithMultiWorld =>
              const PolygonLabelPlacementCalculator
                  .simpleMultiWorldCentroid(),
            // ignore: deprecated_member_use_from_same_package
            PolygonLabelPlacement.polylabel =>
              const PolygonLabelPlacementCalculator.polylabel(),
          };