Update adaptable_page_view.dart (#2134)

Co-authored-by: Matthew Fosse <matt@fosse.co>
This commit is contained in:
Serhii 2025-03-29 00:08:25 +02:00 committed by GitHub
parent b1e5d1503e
commit 869c5a83cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -137,10 +137,25 @@ class _RenderSizingContainer extends RenderProxyBox {
parentUsesSize: true, parentUsesSize: true,
); );
final a = sizes[page.floor()]!; final int floorPage = page.floor();
final b = sizes[page.ceil()]!; final int ceilPage = page.ceil();
Size? a = sizes[floorPage];
Size? b = sizes[ceilPage];
if (a == null && sizes.isNotEmpty) {
a = sizes.values.first;
}
if (b == null && sizes.isNotEmpty) {
b = sizes.values.first;
}
a ??= child.getDryLayout(constraints);
b ??= a;
final double t = (page - floorPage).clamp(0.0, 1.0);
final double height = lerpDouble(a.height, b.height, t) ?? a.height;
final height = lerpDouble(a.height, b.height, page - page.floor());
child.layout( child.layout(
constraints.copyWith(minHeight: height, maxHeight: height), constraints.copyWith(minHeight: height, maxHeight: height),