28 lines
723 B
Dart
28 lines
723 B
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
class AppBreakpoints {
|
|
static const double mobile = 600;
|
|
static const double tablet = 900;
|
|
static const double desktop = 1200;
|
|
|
|
static bool isMobile(BuildContext context) {
|
|
return MediaQuery.of(context).size.width < mobile;
|
|
}
|
|
|
|
static bool isTablet(BuildContext context) {
|
|
final width = MediaQuery.of(context).size.width;
|
|
return width >= mobile && width < desktop;
|
|
}
|
|
|
|
static bool isDesktop(BuildContext context) {
|
|
return MediaQuery.of(context).size.width >= desktop;
|
|
}
|
|
|
|
static double horizontalPadding(double width) {
|
|
if (width >= desktop) return 96;
|
|
if (width >= tablet) return 64;
|
|
if (width >= mobile) return 32;
|
|
return 16;
|
|
}
|
|
}
|