Skip to content

Commit c93121c

Browse files
committed
Fixed parent state should indetermninate while have 1 child. And 1 child state is indeterminate.
1 parent c45a860 commit c93121c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/src/tree_node.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,18 +286,17 @@ class _TreeNodeState extends State<TreeNode> with SingleTickerProviderStateMixin
286286
bool? isParentChecked;
287287
var counterFalse = 0;
288288
var counterTrue = 0;
289-
var counterNull = 0;
290289
for (final child in parent.children) {
291290
final isChecked = child.checked;
292291
if (isChecked == null) {
293-
counterNull += 1;
292+
/* Nothing to do in here */
294293
} else if (isChecked) {
295294
counterTrue += 1;
296295
} else {
297296
counterFalse += 1;
298297
}
299298
}
300-
if (counterTrue == lenChildren || counterNull == lenChildren) {
299+
if (counterTrue == lenChildren) {
301300
isParentChecked = true;
302301
} else if (counterFalse == lenChildren) {
303302
isParentChecked = false;

0 commit comments

Comments
 (0)