Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Overrode computeDryLayout method which fixes error #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions zflutter/lib/src/core/render/render_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ class RenderZBox extends RenderBox {
ZVector origin = ZVector.zero;

void performSort() {
sortValue = this.origin.z;
sortValue = origin.z;
}

@override
Size computeDryLayout(BoxConstraints constraints) => constraints.biggest;
}

enum SortMode { inherit, stack, update }
Expand Down Expand Up @@ -72,9 +75,11 @@ class RenderZMultiChildBox extends RenderZBox
@override
void performSort() {
if (sortMode == SortMode.stack || sortMode == SortMode.update) {
final children = getFlatChildren();
sortValue = children.fold(0,
(previousValue, element) => previousValue + element.sortValue) /
final List<RenderZBox> children = getFlatChildren();
sortValue = children.fold<double>(
0,
(double previousValue, RenderZBox element) =>
previousValue + element.sortValue) /
children.length;
} else {
super.performSort();
Expand All @@ -87,7 +92,7 @@ class RenderZMultiChildBox extends RenderZBox
SortMode sortMode;

List<RenderZBox> getFlatChildren() {
List<RenderZBox> children = [];
final List<RenderZBox> children = [];

RenderZBox child = firstChild;

Expand Down Expand Up @@ -120,7 +125,7 @@ class RenderZMultiChildBox extends RenderZBox
List<RenderZBox> children = getFlatChildren();
//List<RenderBox> children = getChildrenAsList()
if (sortMode != SortMode.stack) {
children..sort((a, b) => a.sortValue.compareTo(b.sortValue));
children.sort((a, b) => a.sortValue.compareTo(b.sortValue));
}
for (final child in children) {
final ZParentData childParentData = child.parentData as ZParentData;
Expand Down