LabelBuilder typedef

LabelBuilder = Widget Function(BuildContext context, Connection connection, ConnectionLabel label, Rect position)

Builder function type for customizing connection label widgets.

This typedef defines the signature for custom label builders that can be provided to NodeFlowEditor to customize how connection labels are rendered.

Parameters:

  • context: The build context
  • connection: The connection containing this label
  • label: The label being rendered
  • position: The calculated position rect for the label (includes size)

Example:

LabelBuilder myLabelBuilder = (context, connection, label, position) {
  return Container(
    padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
    decoration: BoxDecoration(
      color: Colors.amber.shade100,
      borderRadius: BorderRadius.circular(12),
    ),
    child: Row(
      mainAxisSize: MainAxisSize.min,
      children: [
        Icon(Icons.bolt, size: 14),
        SizedBox(width: 4),
        Text(label.text),
      ],
    ),
  );
};

Implementation

typedef LabelBuilder =
    Widget Function(
      BuildContext context,
      Connection connection,
      ConnectionLabel label,
      Rect position,
    );