line function

Component line(
  1. List<Component> children, {
  2. String? x1,
  3. String? y1,
  4. String? x2,
  5. String? y2,
  6. Color? fill,
  7. Color? stroke,
  8. String? strokeWidth,
  9. Key? key,
  10. String? id,
  11. String? classes,
  12. Styles? styles,
  13. Map<String, String>? attributes,
  14. Map<String, EventCallback>? events,
})

The <line> element is an SVG basic shape used to create a line connecting two points.

  • x1: Defines the x-axis coordinate of the line starting point.
  • y1: Defines the y-axis coordinate of the line starting point.
  • x2: Defines the x-axis coordinate of the line ending point.
  • y2: Defines the y-axis coordinate of the line ending point.
  • fill: The color (or gradient or pattern) used to paint the shape.
  • stroke: The color (or gradient or pattern) used to paint the outline of the shape.
  • strokeWidth: The width of the stroke to be applied to the shape.

Implementation

Component line(List<Component> children,
    {String? x1,
    String? y1,
    String? x2,
    String? y2,
    Color? fill,
    Color? stroke,
    String? strokeWidth,
    Key? key,
    String? id,
    String? classes,
    Styles? styles,
    Map<String, String>? attributes,
    Map<String, EventCallback>? events}) {
  return DomComponent(
    tag: 'line',
    key: key,
    id: id,
    classes: classes,
    styles: styles,
    attributes: {
      ...attributes ?? {},
      if (x1 != null) 'x1': x1,
      if (y1 != null) 'y1': y1,
      if (x2 != null) 'x2': x2,
      if (y2 != null) 'y2': y2,
      if (fill != null) 'fill': fill.value,
      if (stroke != null) 'stroke': stroke.value,
      if (strokeWidth != null) 'stroke-width': strokeWidth,
    },
    events: events,
    children: children,
  );
}