Skip to content

Commit 7ace360

Browse files
committed
feat: remove ui.window.physicalSize
feat: remove ui.window.physicalSize
1 parent c0ce50e commit 7ace360

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/src/core/context.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class ZKContext {
4444
}
4545

4646
double get deviceRatio {
47-
return ui.window.devicePixelRatio;
47+
return WidgetsBinding
48+
.instance.platformDispatcher.views.first.devicePixelRatio;
4849
}
4950

5051
double get appWidthDP {
@@ -60,7 +61,11 @@ class ZKContext {
6061
}
6162

6263
bool isLandscape() {
63-
Size s = ui.window.physicalSize / ui.window.devicePixelRatio;
64+
Size os =
65+
WidgetsBinding.instance.platformDispatcher.views.first.physicalSize;
66+
double ratio =
67+
WidgetsBinding.instance.platformDispatcher.views.first.devicePixelRatio;
68+
Size s = os / ratio;
6469
bool landscape = s.width > s.height;
6570
return landscape;
6671
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description: Zerker is a flexible and lightweight flutter canvas graphic animati
1111
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
1212
# Read more about iOS versioning at
1313
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
14-
version: 2.3.1
14+
version: 2.3.2
1515
homepage: https://github.com/flutterkit/zerker
1616

1717
environment:

0 commit comments

Comments
 (0)