Skip to content

Commit c0ce50e

Browse files
committed
feat: change get screenWidth
feat: change get screenWidth
1 parent 54a1628 commit c0ce50e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/src/core/context.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ class ZKContext {
2424
}
2525

2626
double get screenWidth {
27-
return ui.window.physicalSize.width;
27+
// https://stackoverflow.com/questions/76312328/flutter-3-10-window-is-deprecated-and-shouldnt-be-used
28+
return WidgetsBinding
29+
.instance.platformDispatcher.views.first.physicalSize.width;
2830
}
2931

3032
double get screenHeight {
31-
return ui.window.physicalSize.height;
33+
// ui.window.physicalSize
34+
return WidgetsBinding
35+
.instance.platformDispatcher.views.first.physicalSize.height;
3236
}
3337

3438
double get appWidth {

pubspec.yaml

+1-1
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.2.6
14+
version: 2.3.1
1515
homepage: https://github.com/flutterkit/zerker
1616

1717
environment:

0 commit comments

Comments
 (0)