李卓原

空安全优化

... ... @@ -75,14 +75,16 @@ class ScreenUtil {
/// Initializing the library.
static void init(
BuildContext context, {
BuildContext? context, {
Orientation? orientation,
Size? deviceSize,
Size designSize = defaultSize,
bool splitScreenMode = false,
bool minTextAdapt = false,
}) {
final deviceData = MediaQuery.maybeOf(context).nonEmptySizeOrNull();
final deviceData = context != null
? MediaQuery.maybeOf(context).nonEmptySizeOrNull()
: null;
deviceSize ??= deviceData?.size ?? designSize;
orientation ??= deviceData?.orientation ??
... ... @@ -97,7 +99,7 @@ class ScreenUtil {
.._orientation = orientation
.._screenWidth = deviceSize.width
.._screenHeight = deviceSize.height
..context = deviceData != null ? context : null;
..context = context;
}
///获取屏幕方向
... ...
... ... @@ -2,7 +2,6 @@ name: flutter_screenutil
description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models
version: 5.4.0
homepage: https://github.com/OpenFlutter/flutter_screenutil
publish_to: https://pub.dev
environment:
sdk: ">=2.12.0 <3.0.0"
... ...