RectangleLayer static method

RectangleLayer RectangleLayer(
  1. dynamic rectangle, {
  2. bool stroke = strokeRectangleDef,
  3. Color? strokeColor,
  4. double strokeWidth = strokeWidthRectangleDef,
  5. double strokeOpacity = strokeOpacityRectangleDef,
  6. StrokeCap strokeCap = strokeCapDef,
  7. StrokeJoin strokeJoin = strokeJoinDef,
  8. PathFillType pathFillType = pathFillTypeDef,
  9. Color? fillColor,
  10. double fillOpacity = fillOpacityDef,
  11. List<Color> gradientStrokeColors = gradientColorsDef,
  12. List<double> gradientStrokeStops = gradientStopsDef,
  13. List<Color> gradientFillColors = gradientColorsDef,
  14. List<double> gradientFillStops = gradientStopsDef,
  15. bool isDotted = isDottedDef,
  16. double smoothFactor = smoothFactorDef,
  17. bool culling = cullingDef,
  18. bool interactive = interactiveDef,
  19. dynamic data,
  20. TapLayerCallback? onTap,
  21. TapUpLayerCallback? onTapUp,
  22. TapDownLayerCallback? onTapDown,
  23. TapLayerCallback? onTapCancel,
  24. TapLayerCallback? onSecondaryTap,
  25. TapDownLayerCallback? onSecondaryTapDown,
  26. TapUpLayerCallback? onSecondaryTapUp,
  27. TapLayerCallback? onSecondaryTapCancel,
  28. DoubleTapLayerCallback? onDoubleTap,
  29. LongPressLayerCallback? onLongPress,
  30. LongPressStartLayerCallback? onLongPressStart,
  31. LongPressMoveUpdateLayerCallback? onLongPressMoveUpdate,
  32. LongPressUpLayerCallback? onLongPressUp,
  33. LongPressEndLayerCallback? onLongPressEnd,
  34. LongPressLayerCallback? onSecondaryLongPress,
  35. LongPressStartLayerCallback? onSecondaryLongPressStart,
  36. LongPressMoveUpdateLayerCallback? onSecondaryLongPressMoveUpdate,
  37. LongPressUpLayerCallback? onSecondaryLongPressUp,
  38. LongPressEndLayerCallback? onSecondaryLongPressEnd,
})

Implementation

static L.RectangleLayer RectangleLayer(
  dynamic rectangle, {
  bool stroke = strokeRectangleDef,
  Color? strokeColor,
  double strokeWidth = strokeWidthRectangleDef,
  double strokeOpacity = strokeOpacityRectangleDef,
  StrokeCap strokeCap = strokeCapDef,
  StrokeJoin strokeJoin = strokeJoinDef,
  PathFillType pathFillType = pathFillTypeDef,
  Color? fillColor,
  double fillOpacity = fillOpacityDef,
  List<Color> gradientStrokeColors = gradientColorsDef,
  List<double> gradientStrokeStops = gradientStopsDef,
  List<Color> gradientFillColors = gradientColorsDef,
  List<double> gradientFillStops = gradientStopsDef,
  bool isDotted = isDottedDef,
  double smoothFactor = smoothFactorDef,
  bool culling = cullingDef,
  bool interactive = interactiveDef,
  dynamic data,
  L.TapLayerCallback? onTap,
  L.TapUpLayerCallback? onTapUp,
  L.TapDownLayerCallback? onTapDown,
  L.TapLayerCallback? onTapCancel,
  L.TapLayerCallback? onSecondaryTap,
  L.TapDownLayerCallback? onSecondaryTapDown,
  L.TapUpLayerCallback? onSecondaryTapUp,
  L.TapLayerCallback? onSecondaryTapCancel,
  L.DoubleTapLayerCallback? onDoubleTap,
  L.LongPressLayerCallback? onLongPress,
  L.LongPressStartLayerCallback? onLongPressStart,
  L.LongPressMoveUpdateLayerCallback? onLongPressMoveUpdate,
  L.LongPressUpLayerCallback? onLongPressUp,
  L.LongPressEndLayerCallback? onLongPressEnd,
  L.LongPressLayerCallback? onSecondaryLongPress,
  L.LongPressStartLayerCallback? onSecondaryLongPressStart,
  L.LongPressMoveUpdateLayerCallback? onSecondaryLongPressMoveUpdate,
  L.LongPressUpLayerCallback? onSecondaryLongPressUp,
  L.LongPressEndLayerCallback? onSecondaryLongPressEnd,
}) {
  bool isRectangle = rectangle is L.Rectangle;
  bool isLatLngs = rectangle is List &&
      rectangle.isNotEmpty &&
      rectangle.first is List &&
      (rectangle.first.first is int || rectangle.first.first is double);

  List<dynamic> items = (isRectangle || isLatLngs) ? [rectangle] : rectangle;

  return L.RectangleLayer(
    items.map((value) => L.Rectangle.from(value, data: data)).toList(),
    options: L.RectangleLayerOptions(
      stroke: stroke,
      strokeColor: strokeColor ?? fillColor,
      strokeWidth: strokeWidth,
      strokeOpacity: strokeOpacity,
      strokeCap: strokeCap,
      strokeJoin: strokeJoin,
      pathFillType: pathFillType,
      fillColor: fillColor,
      fillOpacity: fillOpacity,
      gradientStrokeColors: gradientStrokeColors,
      gradientStrokeStops: gradientStrokeStops,
      gradientFillColors: gradientFillColors,
      gradientFillStops: gradientFillStops,
      isDotted: isDotted,
      smoothFactor: smoothFactor,
      culling: culling,
      interactive: interactive,
      onTap: onTap,
      onTapUp: onTapUp,
      onTapDown: onTapDown,
      onTapCancel: onTapCancel,
      onSecondaryTap: onSecondaryTap,
      onSecondaryTapDown: onSecondaryTapDown,
      onSecondaryTapUp: onSecondaryTapUp,
      onSecondaryTapCancel: onSecondaryTapCancel,
      onDoubleTap: onDoubleTap,
      onLongPress: onLongPress,
      onLongPressStart: onLongPressStart,
      onLongPressMoveUpdate: onLongPressMoveUpdate,
      onLongPressUp: onLongPressUp,
      onLongPressEnd: onLongPressEnd,
      onSecondaryLongPress: onSecondaryLongPress,
      onSecondaryLongPressStart: onSecondaryLongPressStart,
      onSecondaryLongPressMoveUpdate: onSecondaryLongPressMoveUpdate,
      onSecondaryLongPressUp: onSecondaryLongPressUp,
      onSecondaryLongPressEnd: onSecondaryLongPressEnd,
    ),
  );
}