import 'package:flutter/material.dart'; class Responsive extends StatelessWidget { final Widget mobile; final Widget? tablet; final Widget desktop; const Responsive({ super.key, required this.mobile, this.tablet, required this.desktop, }); static bool isMobile(BuildContext context) => MediaQuery.of(context).size.width < 576; static bool isTablet(BuildContext context) => MediaQuery.of(context).size.width >= 576 && MediaQuery.of(context).size.width <= 992; static bool isDesktop(BuildContext context) => MediaQuery.of(context).size.width > 992; @override Widget build(BuildContext context) { if (isDesktop(context)) { return desktop; } else if (tablet != null && isTablet(context)) { return tablet!; } return mobile; } }