PortDefinition.onSide constructor

PortDefinition.onSide({
  1. required String id,
  2. required PortSide side,
  3. double position = 0.5,
  4. String? targetLayerId,
  5. PortStyle style = const PortStyle(),
})

Creates a port on one side of the shape. position is normalized along that side from left-to-right or top-to-bottom.

Implementation

factory PortDefinition.onSide({
  required String id,
  required PortSide side,
  double position = 0.5,
  String? targetLayerId,
  PortStyle style = const PortStyle(),
}) => PortDefinition(
  id: id,
  placement: PortPlacement.sideFraction(
    side: side,
    offset: position,
    targetLayerId: targetLayerId,
  ),
  style: style,
);