ForceSimulation.withDefaults constructor
ForceSimulation.withDefaults({
- required List<
NetworkNode> nodes, - required List<
NetworkLink> links, - double centerX = 0,
- double centerY = 0,
- double chargeStrength = -30,
- double linkDistance = 30,
- void onTick()?,
- void onEnd()?,
Creates a simulation with default forces.
Implementation
factory ForceSimulation.withDefaults({
required List<NetworkNode> nodes,
required List<NetworkLink> links,
double centerX = 0,
double centerY = 0,
double chargeStrength = -30,
double linkDistance = 30,
void Function()? onTick,
void Function()? onEnd,
}) {
return ForceSimulation(
nodes: nodes,
links: links,
forces: [
CenterForce(x: centerX, y: centerY),
ManyBodyForce(strength: chargeStrength),
LinkForce(links: links, distance: linkDistance),
],
onTick: onTick,
onEnd: onEnd,
);
}