computeCardRect static method

Rect computeCardRect(
  1. Size screenSize, {
  2. double widthFraction = 0.85,
  3. double heightFraction = 0.72,
})

Compute a centered card rect from screen size and dimension fractions.

Implementation

static Rect computeCardRect(
  Size screenSize, {
  double widthFraction = 0.85,
  double heightFraction = 0.72,
}) {
  final w = screenSize.width * widthFraction;
  final h = screenSize.height * heightFraction;
  final left = (screenSize.width - w) / 2;
  final top = (screenSize.height - h) / 2;
  return Rect.fromLTWH(left, top, w, h);
}