OptimizedNetworkPainter class

The main painter class for rendering an optimized particle network.

This class implements CustomPainter to efficiently render:

  • Individual particles as circles
  • Connection lines between nearby particles
  • Touch interaction effects

Optimization Techniques:

  1. Spatial partitioning using QuadTree
  2. Distance calculation caching
  3. Visible particle filtering
  4. Batched drawing operations
  5. Conditional rendering based on visibility
Inheritance

Constructors

OptimizedNetworkPainter({required int particleCount, required List<Particle> particles, required Offset? touchPoint, required double lineDistance, required Color particleColor, required Color lineColor, required Color touchColor, required bool touchActivation, required double lineWidth, required bool isComplex, required bool fill, required bool drawNetwork, bool showQuadTree = false})
Constructor with dependency initialization

Properties

drawNetwork bool
Whether to draw the web of connection lines between particles.
final
fill bool
Whether to fill particles (true) or draw them as outlines (false).
final
hashCode int
The hash code for this object.
no setterinherited
isComplex bool
Whether to use complex (high-quality) or optimized painting logic.
final
lineColor Color
The color used for connecting lines between particles.
final
lineDistance double
The maximum distance (in pixels) for connection lines to be drawn.
final
linePaint Paint
latefinal
lineWidth double
The width of the connecting lines.
final
particleColor Color
The base color for rendering particles.
final
particleCount int
The total number of particles, used for pre-allocation optimizations.
final
particlePaint Paint
latefinal
particles List<Particle>
The list of particles currently in the system.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsBuilder SemanticsBuilderCallback?
Returns a function that builds semantic information for the picture drawn by this painter.
no setterinherited
showQuadTree bool
Whether to visualize the underlying QuadTree structure for debugging.
final
touchActivation bool
Whether touch interaction effects are enabled.
final
touchColor Color
The color used to highlight particles near a touch point.
final
touchPoint Offset?
The current touch position, if any.
final

Methods

addListener(VoidCallback listener) → void
Register a closure to be notified when it is time to repaint.
inherited
hitTest(Offset position) bool?
Called whenever a hit test is being performed on an object that is using this custom paint delegate.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
paint(Canvas canvas, Size size) → void
Called whenever the object needs to paint. The given Canvas has its coordinate space configured such that the origin is at the top left of the box. The area of the box is the size of the size argument.
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies when it is time to repaint.
inherited
shouldRebuildSemantics(covariant CustomPainter oldDelegate) bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
inherited
shouldRepaint(covariant OptimizedNetworkPainter oldDelegate) bool
Called whenever a new instance of the custom painter delegate class is provided to the RenderCustomPaint object, or any time that a new CustomPaint object is created with a new instance of the custom painter delegate class (which amounts to the same thing, because the latter is implemented in terms of the former).
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited