Unverified Commit a12c5618 authored by rami-a's avatar rami-a Committed by GitHub

Prevent vertical scroll in shrine by ensuring card size fits the screen (#30455)

parent 0b8403b6
...@@ -31,10 +31,12 @@ class TwoProductCardColumn extends StatelessWidget { ...@@ -31,10 +31,12 @@ class TwoProductCardColumn extends StatelessWidget {
const double spacerHeight = 44.0; const double spacerHeight = 44.0;
final double heightOfCards = (constraints.biggest.height - spacerHeight) / 2.0; final double heightOfCards = (constraints.biggest.height - spacerHeight) / 2.0;
final double heightOfImages = heightOfCards - ProductCard.kTextBoxHeight; final double availableHeightForImages = heightOfCards - ProductCard.kTextBoxHeight;
final double imageAspectRatio = (heightOfImages >= 0.0 && constraints.biggest.width > heightOfImages) // Ensure the cards take up the available space as long as the screen is
? constraints.biggest.width / heightOfImages // sufficiently tall, otherwise fallback on a constant aspect ratio.
: 33 / 49; final double imageAspectRatio = availableHeightForImages >= 0.0
? constraints.biggest.width / availableHeightForImages
: 49.0 / 33.0;
return ListView( return ListView(
physics: const ClampingScrollPhysics(), physics: const ClampingScrollPhysics(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment