| 123456789101112131415161718192021222324252627282930313233 |
- import 'package:flutter/material.dart';
- class ResponsiveBreakpoints {
- static const double phone = 700;
- static const double tablet = 900;
- static const double sidebarWidth = 288;
- 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 bool showPersistentSidebar(BuildContext context) =>
- MediaQuery.of(context).size.width >= phone;
- 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;
- }
- }
|