33 lines
982 B
Dart
33 lines
982 B
Dart
import 'dart:math' as math;
|
|
|
|
/// Shared desktop geometry for cards, rows, headers and browse anchoring.
|
|
abstract final class DesktopMediaMetrics {
|
|
static const padding = 16.0;
|
|
static const gap = 8.0;
|
|
static const tilePadding = 8.0;
|
|
static const listCover = 56.0;
|
|
static const listRow = 48.0;
|
|
|
|
static int columns(double width, double targetWidth) =>
|
|
math.max(1, ((width + gap) / (targetWidth + gap)).ceil());
|
|
|
|
static double gridExtent(double tileWidth, double labelHeight) =>
|
|
(tileWidth - tilePadding * 2) * 9 / 16 +
|
|
4 +
|
|
labelHeight +
|
|
tilePadding * 2;
|
|
}
|
|
|
|
/// List-column visibility within asset rows.
|
|
final class DesktopMediaListColumns {
|
|
const DesktopMediaListColumns(double width)
|
|
: duration = width >= 240,
|
|
specification = width >= 480,
|
|
kind = width >= 620;
|
|
|
|
final bool duration, specification, kind;
|
|
static const durationWidth = 64.0;
|
|
static const specificationWidth = 136.0;
|
|
static const kindWidth = 56.0;
|
|
}
|