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)
- Snapping state (when a connection is being dragged near the port)
Example:
// Create a custom port theme
final customTheme = PortTheme(
size: 12.0,
color: Colors.grey,
connectedColor: Colors.green,
snappingColor: Colors.lightGreen,
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 snappingColor, required Color borderColor, required double borderWidth, MarkerShape shape = MarkerShapes.capsuleHalf, bool showLabel = false, TextStyle? labelTextStyle, double labelOffset = 4.0, double labelVisibilityThreshold = 0.5, Color highlightBorderColor = const Color(0xFF000000), double highlightBorderWidthDelta = 1.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
- highlightBorderWidthDelta → double
-
Additional border width applied when the port is highlighted.
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 of the port when a connection is being dragged near it.
final
Methods
-
copyWith(
{Size? size, Color? color, Color? connectedColor, Color? snappingColor, Color? borderColor, double? borderWidth, MarkerShape? shape, bool? showLabel, TextStyle? labelTextStyle, double? labelOffset, double? labelVisibilityThreshold, Color? highlightBorderColor, double? highlightBorderWidthDelta}) → 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
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited