heightFor static method

double heightFor(
  1. TextScaler scaler, {
  2. bool note = false,
})

The height a carousel row needs for these cards at the user's text size: the 154 pt photo, the 10 pt gap and the three text lines at their scaled line heights (the score badge keeps its 20 pt minimum); with note, the deal's line too.

Implementation

static double heightFor(TextScaler scaler, {bool note = false}) {
  double line(double size, double height) => scaler.scale(size) * height;
  final scoreRow = line(13, 1.3) > 20 ? line(13, 1.3) : 20.0;
  final priceRow = line(15, 1.2) > line(12, 1.25) ? line(15, 1.2) : line(12, 1.25);
  return (154 + 10 + line(16, 1.25) + 3 + scoreRow + 3 + priceRow + (note ? 3 + line(12, 1.3) : 0)).ceilToDouble();
}