Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 0d4e94e

Browse files
author
Yuncong Zhang
committed
[1.5.4] Upgrade sliver.
1 parent e6fcde4 commit 0d4e94e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Runtime/rendering/sliver.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ public SliverGeometry(
341341
public readonly bool hasVisualOverflow;
342342
public readonly float? scrollOffsetCorrection;
343343
public readonly float cacheExtent;
344+
public const float precisionErrorTolerance = 1e-10f;
344345

345346
internal static string _debugCompareFloats(string labelA, float valueA, string labelB, float valueB) {
346347
if (valueA.ToString("F1") != valueB.ToString("F1")) {
@@ -381,7 +382,7 @@ public bool debugAssertIsValid(InformationCollector informationCollector = null)
381382
);
382383
}
383384

384-
if (this.maxPaintExtent < this.paintExtent) {
385+
if (this.paintExtent - this.maxPaintExtent > precisionErrorTolerance) {
385386
verify(false,
386387
"The \"maxPaintExtent\" is less than the \"paintExtent\".\n" +
387388
_debugCompareFloats("maxPaintExtent", this.maxPaintExtent, "paintExtent",

Runtime/rendering/sliver_grid.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ public override int getMaxChildIndexForScrollOffset(float scrollOffset) {
113113

114114
float _getOffsetFromStartInCrossAxis(float crossAxisStart) {
115115
if (this.reverseCrossAxis == true) {
116-
return (this.crossAxisCount * this.crossAxisStride - crossAxisStart - this.childCrossAxisExtent) ??
116+
return (this.crossAxisCount * this.crossAxisStride - crossAxisStart - this.childCrossAxisExtent
117+
- (this.crossAxisStride - this.childCrossAxisExtent)) ??
117118
0.0f;
118119
}
119120

Runtime/rendering/sliver_list.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ protected override void performLayout() {
5757
}
5858
else {
5959
float firstChildScrollOffset = earliestScrollOffset - this.paintExtentOf(this.firstChild);
60-
if (firstChildScrollOffset < 0.0) {
60+
if (firstChildScrollOffset < -SliverGeometry.precisionErrorTolerance) {
6161
float correction = 0.0f;
6262
while (earliestUsefulChild != null) {
6363
D.assert(this.firstChild == earliestUsefulChild);

0 commit comments

Comments
 (0)