skywood/lib/utils/tools/app_screen.dart

45 lines
1.2 KiB
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
/// AppScreen class
class AppScreen {
static double get screenWidth => Get.width;
static double get screenHeight => Get.height;
// static double get screenWidth => MediaQuery.of(Get.context!).size.width;
// static double get screenHeight => MediaQuery.of(Get.context!).size.height;
static Size size(BuildContext context) {
return MediaQuery.of(context).size;
}
static bool get isDebug=> kDebugMode;
static double get statusBarHeight => Get.statusBarHeight / Get.pixelRatio;
static double get bottomBarHeight => Get.bottomBarHeight / Get.pixelRatio;
// static double get tabBarHeight => kToolbarHeight;
static double get navBarHeight => kToolbarHeight + statusBarHeight;
static bool get isDark => Get.isDarkMode;
static bool get isAndroid {
return GetPlatform.isAndroid;
}
static bool get isIos {
return GetPlatform.isIOS;
}
static double aRatioWidth({double? h, double aspectRatio = 1}) {
h ??= screenHeight;
return screenHeight * 1 / aspectRatio;
}
static double get keyboardHeight => Get.mediaQuery.viewInsets.bottom;
}