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