import 'package:flutter/widgets.dart';

class ResponsiveHelper {
  final double width;
  final double height;
  final bool isLandscape;
  final bool isWide;

  const ResponsiveHelper({
    required this.width,
    required this.height,
    required this.isLandscape,
    required this.isWide,
  });

  factory ResponsiveHelper.of(BuildContext context) {
    final media = MediaQuery.of(context);
    final w = media.size.width;
    final h = media.size.height;
    return ResponsiveHelper(
      width: w,
      height: h,
      isLandscape: w > h,
      isWide: w > 600,
    );
  }

  int get gridColumns {
    if (width > 900) return 4;
    if (isLandscape) return 3;
    return 2;
  }

  double get listMaxWidth => isWide ? 600 : double.infinity;

  double get formMaxWidth => isWide ? 800 : double.infinity;

  bool get formTwoColumns => isWide;

  bool get detailTwoColumns => isWide;
}
