feat: 主页面功能
This commit is contained in:
1 parent
91edb73885
commit
f233f1c642
21 files changed
+1295
-104
No files matched your search
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
/// AppScreen class
|
||||
class AppScreen {
|
||||
static double get screenWidth => _viewSize.width;
|
||||
static double get screenHeight => _viewSize.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 Size get _viewSize {
|
||||
if (Get.context != null) {
|
||||
return MediaQuery.of(Get.context!).size;
|
||||
}
|
||||
|
||||
final view = WidgetsBinding.instance.platformDispatcher.views.first;
|
||||
return view.physicalSize / view.devicePixelRatio;
|
||||
}
|
||||
|
||||
static double aRatioWidth({double? h, double aspectRatio = 1}) {
|
||||
h ??= screenHeight;
|
||||
return screenHeight * 1 / aspectRatio;
|
||||
}
|
||||
|
||||
static double get keyboardHeight => Get.mediaQuery.viewInsets.bottom;
|
||||
}
|
||||
Reference in new issue
Block a user