Fix typo in SliverLayoutDimensions.hashCode where not all properties are used in the hash code. (#150306)

https://github.com/flutter/flutter/issues/150305
fix typo in `SliverLayoutDimensions.hashCode` where not all properties are used in the hash code.
This commit is contained in:
PurplePolyhedron 2024-06-18 08:34:20 +10:00 committed by GitHub
parent cf375f0dfb
commit c1a6a631fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View file

@ -80,7 +80,7 @@ class SliverLayoutDimensions {
scrollOffset,
precedingScrollExtent,
viewportMainAxisExtent,
viewportMainAxisExtent
crossAxisExtent,
);
}

View file

@ -1019,6 +1019,25 @@ void main() {
}
expect(threw, true);
});
// Regression test for https://github.com/flutter/flutter/issues/150305
test('SliverLayoutDimensions has correct hashCode', () {
const SliverLayoutDimensions dimensions = SliverLayoutDimensions(
scrollOffset: 1.0,
precedingScrollExtent: 2.0,
viewportMainAxisExtent: 3.0,
crossAxisExtent: 4.0,
);
expect(
dimensions.hashCode,
Object.hash(
dimensions.scrollOffset,
dimensions.precedingScrollExtent,
dimensions.viewportMainAxisExtent,
dimensions.crossAxisExtent,
),
);
});
}
class _DummyHitTestTarget implements HitTestTarget {