PortTheme class
Theme configuration for port visual appearance.
PortTheme defines the visual styling of ports in the flow editor, including colors for different interaction states, size, and border styling.
The theme supports different visual states:
- Normal state (default appearance)
- Connected state (when the port has active connections)
- Highlighted state (when a connection is being dragged near the port)
Example:
// Create a custom port theme
final customTheme = PortTheme(
size: Size(12, 12),
color: Colors.grey,
connectedColor: Colors.green,
highlightColor: Colors.lightGreen,
highlightBorderColor: Colors.black,
borderColor: Colors.white,
borderWidth: 2.0,
);
// Or use a predefined theme
final lightTheme = PortTheme.light;
final darkTheme = PortTheme.dark;
Constructors
- PortTheme({required Size size, required Color color, required Color connectedColor, required Color highlightColor, required Color highlightBorderColor, required Color snappingColor, required Color borderColor, required double borderWidth, MarkerShape shape = MarkerShapes.capsuleHalf, bool showLabel = false, TextStyle? labelTextStyle, double labelOffset = 4.0, double labelVisibilityThreshold = 0.5})
-
Creates a port theme with the specified visual properties.
const
Properties
- borderColor → Color
-
The color of the port's border.
final
- borderWidth → double
-
The width of the port's border in logical pixels.
final
- color → Color
-
The default color of the port when idle.
final
- connectedColor → Color
-
The color of the port when it has active connections.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- highlightBorderColor → Color
-
The border color when the port is highlighted (being hovered during drag).
final
- highlightColor → Color
-
The fill color when the port is highlighted (being hovered during drag).
final
- labelOffset → double
-
The distance from the port center to the label in logical pixels.
final
- labelTextStyle → TextStyle?
-
The text style for port labels.
final
- labelVisibilityThreshold → double
-
The minimum zoom level at which port labels become visible.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shape → MarkerShape
-
The default marker shape for ports.
final
- showLabel → bool
-
Whether to show port labels globally for all ports.
final
- size → Size
-
The size of the port in logical pixels.
final
- snappingColor → Color
-
The color for the snapping circle shown around the port during hover.
final
Methods
-
copyWith(
{Size? size, Color? color, Color? connectedColor, Color? highlightColor, Color? highlightBorderColor, Color? snappingColor, Color? borderColor, double? borderWidth, MarkerShape? shape, bool? showLabel, TextStyle? labelTextStyle, double? labelOffset, double? labelVisibilityThreshold}) → PortTheme - Creates a copy of this theme with the specified properties replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
resolveSize(
Port port) → Size - Resolves the effective size for a port.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited