Skip to content

Commit 5aac9bd

Browse files
committed
Update docs in node_processor.dart
1 parent b37e7cc commit 5aac9bd

1 file changed

Lines changed: 16 additions & 13 deletions

File tree

lib/src/api/node_processor.dart

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extension NodeBoxHelper on NodeBox {
3737
NodeProcessor.updateNode(
3838
node: node,
3939
basicBoxLocal: box,
40-
constraintOverrides: constraintOverrides,
40+
resolvedConstraints: constraintOverrides,
4141
resetRetainedBox: resetRetainedBox,
4242
recursivelyCalculateChildrenGlobalBoxes:
4343
recursivelyCalculateChildrenGlobalBoxes,
@@ -166,17 +166,20 @@ class NodeProcessor {
166166
NodeProcessor.getNode = getNode;
167167
}
168168

169-
/// There are normal [constraints] field, but they do not tell the full
170-
/// story of provided node's true constraints.
169+
/// There's the normal [constraints] field, but those constraints don't tell
170+
/// the full story of the provided node's true constraints.
171171
///
172172
/// The [constraints] field is what is manually set by the user. However,
173173
/// we have additional constraints that are computed for different nodes.
174-
/// Material components may provide additional internal
175-
/// constraints. Images may provide their original sizes when shrink-wrapping,
176-
/// ListTiles provide a minimum size that the leading node must have, etc...
174+
/// Material components may provide additional internal constraints. Images
175+
/// may provide their original sizes when shrink-wrapping, ListTiles provide
176+
/// a minimum size that the leading node must have, etc...
177177
///
178178
/// This function will take the [internalConstraints] and union them to the
179179
/// [constraints] field to get a reinforced set of constraints.
180+
///
181+
/// This function is recursive and may travel up the parent tree from the
182+
/// internal [BaseNode.relegatedConstraintsToChildren] function.
180183
static BoxConstraintsModel resolveConstraints(
181184
BaseNode node, {
182185
SizeFit? horizontalFit,
@@ -254,8 +257,8 @@ class NodeProcessor {
254257

255258
/// Sorted nodes is a list of nodes that go from parent -> child.
256259
static void sortNodes(List<BaseNode> nodes) {
257-
// Optimization: We can cache the parent chains for each node to avoid
258-
// computing them multiple times.
260+
// We cache the parent chains for each node to avoid
261+
// re-computing them multiple times as an optimization.
259262
final Map<BaseNode, List<String>> parentChains = {};
260263

261264
nodes.sort((a, b) {
@@ -311,8 +314,8 @@ class NodeProcessor {
311314
/// list of nodes one-by-one order from parent to child order. If this is
312315
/// the case, then we can make important assumptions that can help optimize
313316
/// and avoid recursive computation.
314-
///
315-
/// [constraintOverrides] overrides [node.resolvedConstraints] while being
317+
///
318+
/// [resolvedConstraints] overrides [node.resolvedConstraints] while being
316319
/// still affected by user given constraints.
317320
static void updateNode({
318321
required BaseNode node,
@@ -323,7 +326,7 @@ class NodeProcessor {
323326
OuterNodeBox? outerBoxGlobal,
324327
NodeBox? basicBoxLocal,
325328
BoxConstraintsModel? constraints,
326-
BoxConstraintsModel? constraintOverrides,
329+
BoxConstraintsModel? resolvedConstraints,
327330
int? rotationDegrees,
328331
bool resetRetainedBox = true,
329332
bool recursivelyCalculateChildrenGlobalBoxes = true,
@@ -350,8 +353,8 @@ class NodeProcessor {
350353
if (constraintsChanged) {
351354
node._constraints = constraints;
352355
}
353-
if (constraintOverrides != null) {
354-
node._resolvedConstraints = node._constraints.union(constraintOverrides);
356+
if (resolvedConstraints != null) {
357+
node._resolvedConstraints = node._constraints.union(resolvedConstraints);
355358
} else {
356359
node._resolvedConstraints = resolveConstraints(node);
357360
}

0 commit comments

Comments
 (0)