58 lines
1.1 KiB
Dart
58 lines
1.1 KiB
Dart
// Author: fengshengxiong
|
|
// Date: 2024/5/7
|
|
// Description: 屏幕适配器
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
class ScreenAdapter {
|
|
/// 当前设备宽度 dp
|
|
static double getScreenWidth() {
|
|
return ScreenUtil().screenWidth;
|
|
}
|
|
|
|
/// 当前设备高度 dp
|
|
static double getScreenHeight() {
|
|
return ScreenUtil().screenHeight;
|
|
}
|
|
|
|
/// 状态栏高度 dp 刘海屏会更高
|
|
static double getStatusBarHeight() {
|
|
return ScreenUtil().statusBarHeight;
|
|
}
|
|
|
|
/// 底部安全区距离 dp
|
|
static double getBottomBarHeight() {
|
|
return ScreenUtil().bottomBarHeight;
|
|
}
|
|
|
|
/// 屏幕宽度的倍数
|
|
static double sw(num value) {
|
|
return value.sw;
|
|
}
|
|
|
|
/// 屏幕高度的倍数
|
|
static double sh(num value) {
|
|
return value.sh;
|
|
}
|
|
|
|
/// [ScreenUtil.setWidth]
|
|
static double w(num value) {
|
|
return value.w;
|
|
}
|
|
|
|
/// [ScreenUtil.setHeight]
|
|
static double h(num value) {
|
|
return value.h;
|
|
}
|
|
|
|
/// [ScreenUtil.radius]
|
|
static double r(num value) {
|
|
return value.r;
|
|
}
|
|
|
|
/// [ScreenUtil.setSp]
|
|
static double sp(num value) {
|
|
return value.sp;
|
|
}
|
|
}
|