NodeFlowTheme class

Theme configuration for the node flow editor.

Defines the visual appearance and styling for all elements in the node flow editor including nodes, connections, ports, grid, and interaction feedback.

The theme uses Flutter's ThemeExtension pattern, allowing it to be integrated with Flutter's theming system and accessed via Theme.of(context).

Theme Hierarchy

The theme is organized into logical sub-themes:

Two built-in themes are provided:

Example usage:

// Use a built-in theme
NodeFlowEditor(
  theme: NodeFlowTheme.light,
  // ...
);

// Customize a theme
final customTheme = NodeFlowTheme.light.copyWith(
  backgroundColor: Colors.grey[100],
  gridTheme: GridTheme.light.copyWith(
    style: GridStyles.hierarchical,
  ),
  nodeTheme: NodeTheme.light.copyWith(
    defaultColor: Colors.blue,
  ),
);

// Access theme from context (when using Theme widget)
final theme = Theme.of(context).extension<NodeFlowTheme>()!;
Inheritance

Constructors

NodeFlowTheme({required NodeTheme nodeTheme, required ConnectionTheme connectionTheme, required ConnectionTheme temporaryConnectionTheme, Duration connectionAnimationDuration = const Duration(seconds: 2), required PortTheme portTheme, required LabelTheme labelTheme, required AnnotationTheme annotationTheme, required GridTheme gridTheme, required SelectionTheme selectionTheme, required CursorTheme cursorTheme, Color backgroundColor = Colors.white, bool debugMode = false})
const

Properties

annotationTheme AnnotationTheme
Theme for annotation appearance (selection, highlight colors).
final
backgroundColor Color
Background color of the canvas.
final
connectionAnimationDuration Duration
Duration for the connection animation controller cycle.
final
connectionTheme ConnectionTheme
Theme for established connection appearance (colors, stroke width, style, etc.).
final
cursorTheme CursorTheme
Theme for mouse cursor styles.
final
debugMode bool
Whether to enable debug visualization.
final
gridTheme GridTheme
Theme for grid background appearance (color, size, style).
final
hashCode int
The hash code for this object.
no setterinherited
labelTheme LabelTheme
Theme for connection label styling (font, background, positioning).
final
nodeTheme NodeTheme
Theme for node appearance (colors, borders, shadows, etc.).
final
portTheme PortTheme
Theme for port appearance (size, colors, shapes).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionTheme SelectionTheme
Theme for selection rectangle and indicator colors.
final
temporaryConnectionTheme ConnectionTheme
Theme for temporary connection appearance during connection creation.
final
type Object
The extension's type.
no setterinherited

Methods

copyWith({NodeTheme? nodeTheme, ConnectionTheme? connectionTheme, ConnectionTheme? temporaryConnectionTheme, Duration? connectionAnimationDuration, PortTheme? portTheme, LabelTheme? labelTheme, AnnotationTheme? annotationTheme, GridTheme? gridTheme, SelectionTheme? selectionTheme, CursorTheme? cursorTheme, Color? backgroundColor, bool? debugMode}) NodeFlowTheme
Creates a copy of this theme extension with the given fields replaced by the non-null parameter values.
override
lerp(covariant NodeFlowTheme? other, double t) NodeFlowTheme
Linearly interpolate with another ThemeExtension object.
override
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

Static Properties

dark NodeFlowTheme
Built-in dark theme with muted colors and visible grid.
final
light NodeFlowTheme
Built-in light theme with bright colors and subtle grid.
final