| 1234567891011121314151617181920212223242526272829 |
- import 'package:flutter/material.dart';
- class ResponsiveBreakpoints {
- static const double phone = 600;
- static const double tablet = 900;
- static bool isPhone(BuildContext context) =>
- MediaQuery.of(context).size.width < phone;
- static bool isTablet(BuildContext context) =>
- MediaQuery.of(context).size.width >= phone &&
- MediaQuery.of(context).size.width < tablet;
- static bool isDesktop(BuildContext context) =>
- MediaQuery.of(context).size.width >= tablet;
- static EdgeInsets padding(BuildContext context) {
- final w = MediaQuery.of(context).size.width;
- if (w >= tablet) return const EdgeInsets.all(24);
- if (w >= phone) return const EdgeInsets.all(16);
- return const EdgeInsets.all(12);
- }
- static double contentMaxWidth(BuildContext context) {
- final w = MediaQuery.of(context).size.width;
- if (w >= tablet) return w * 0.7;
- return w;
- }
- }
|