Files
pte/untitled/lib/utils/Screen.dart
2024-09-27 01:31:25 +08:00

27 lines
651 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
/*
* 尺寸兼容类似前端的rem
*/
class Screen {
static double setWidth (double width) {
return ScreenUtil().setWidth(width);
}
static double setHeight (double height) {
return ScreenUtil().setHeight(height);
}
static double setFontSize(double Size) {
return ScreenUtil().setSp(Size, allowFontScalingSelf: true);
}
static double width(BuildContext context) {
return MediaQuery.of(context).size.width;
}
static double height(BuildContext context) {
return MediaQuery.of(context).size.height;
}
}