Fill in SliverConstraints fields missing from ==, hashCode, toString (#143661)

I was doing some debugging on a RenderSliver subclass, and found
that SliverConstraints.toString was missing the precedingScrollExtent
field.

Add that, and add both that field and userScrollDirection to the
`==` and hashCode implementations, which had been skipping them,
so that all three methods now handle all the class's fields.
This commit is contained in:
Greg Price
2024-03-05 19:23:18 -08:00
committed by GitHub
parent a431dee5c9
commit 6b9d3ea4fc
6 changed files with 59 additions and 54 deletions

View File

@@ -556,7 +556,9 @@ class SliverConstraints extends Constraints {
assert(other.debugAssertIsValid());
return other.axisDirection == axisDirection
&& other.growthDirection == growthDirection
&& other.userScrollDirection == userScrollDirection
&& other.scrollOffset == scrollOffset
&& other.precedingScrollExtent == precedingScrollExtent
&& other.overlap == overlap
&& other.remainingPaintExtent == remainingPaintExtent
&& other.crossAxisExtent == crossAxisExtent
@@ -570,7 +572,9 @@ class SliverConstraints extends Constraints {
int get hashCode => Object.hash(
axisDirection,
growthDirection,
userScrollDirection,
scrollOffset,
precedingScrollExtent,
overlap,
remainingPaintExtent,
crossAxisExtent,
@@ -587,6 +591,7 @@ class SliverConstraints extends Constraints {
'$growthDirection',
'$userScrollDirection',
'scrollOffset: ${scrollOffset.toStringAsFixed(1)}',
'precedingScrollExtent: ${precedingScrollExtent.toStringAsFixed(1)}',
'remainingPaintExtent: ${remainingPaintExtent.toStringAsFixed(1)}',
if (overlap != 0.0) 'overlap: ${overlap.toStringAsFixed(1)}',
'crossAxisExtent: ${crossAxisExtent.toStringAsFixed(1)}',