25 lines
747 B
Dart
25 lines
747 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:responsive_framework/responsive_framework.dart';
|
|
|
|
class AppBreakpoints {
|
|
AppBreakpoints._();
|
|
|
|
static const double mobile = 0;
|
|
static const double tablet = 600;
|
|
static const double desktop = 1024;
|
|
static const double wide = 1440;
|
|
}
|
|
|
|
extension ResponsiveContext on BuildContext {
|
|
bool get isMobile => ResponsiveBreakpoints.of(this).isMobile;
|
|
bool get isTablet => ResponsiveBreakpoints.of(this).isTablet;
|
|
bool get isDesktop => ResponsiveBreakpoints.of(this).largerThan(TABLET);
|
|
bool get isWide => ResponsiveBreakpoints.of(this).largerThan(DESKTOP);
|
|
|
|
double get contentMaxWidth {
|
|
if (isWide) return 1400;
|
|
if (isDesktop) return 1200;
|
|
return double.infinity;
|
|
}
|
|
}
|