forShapes static method

List<DiagramToolDefinition> forShapes(
  1. Iterable<ShapeDefinition> shapes, {
  2. required String group,
})

One palette creation tool per shape, identified by its type, in group. Add them to an extension's tools beside its shapes.

Implementation

static List<DiagramToolDefinition> forShapes(
  Iterable<ShapeDefinition> shapes, {
  required String group,
}) => [
  for (final shape in shapes)
    DiagramToolDefinition(
      id: DiagramTool(shape.type),
      label: shape.name ?? shape.type,
      group: group,
      returnToDefault: true,
      behavior: DiagramShapeTool(shapeType: shape.type),
    ),
];