ShapeDefinition.labeled constructor

ShapeDefinition.labeled(
  1. String type, {
  2. required String name,
  3. String? text,
  4. ShapeOutline outline = const ShapeOutline.rect(),
  5. ShapeConnectionDefinition connection = const ShapeConnectionDefinition.outline(),
  6. DiagramSize size = const DiagramSize(160, 100),
  7. ShapeStyle style = const ShapeStyle(),
  8. double padding = 16,
  9. ParagraphAlignment alignment = ParagraphAlignment.center,
  10. ShapeBehavior behavior = const ShapeBehavior(),
  11. Map<String, ValueField> values = const {},
})

A shape whose whole region is one padded, editable text slot ('label', initially text or name).

Implementation

factory ShapeDefinition.labeled(
  String type, {
  required String name,
  String? text,
  ShapeOutline outline = const ShapeOutline.rect(),
  ShapeConnectionDefinition connection =
      const ShapeConnectionDefinition.outline(),
  DiagramSize size = const DiagramSize(160, 100),
  ShapeStyle style = const ShapeStyle(),
  double padding = 16,
  ParagraphAlignment alignment = ParagraphAlignment.center,
  ShapeBehavior behavior = const ShapeBehavior(),
  Map<String, ValueField> values = const {},
}) => ShapeDefinition(
  type: type,
  name: name,
  outline: outline,
  connection: connection,
  size: size,
  style: style,
  behavior: behavior,
  values: values,
  body: ShapeParts.labeled(
    text ?? name,
    padding: padding,
    alignment: alignment,
  ),
);