Skip to content

Commit

Permalink
feat: change get screenWidth
Browse files Browse the repository at this point in the history
feat: change  get screenWidth
  • Loading branch information
drawcall committed Aug 2, 2023
1 parent 54a1628 commit c0ce50e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/src/core/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ class ZKContext {
}

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

double get screenHeight {
return ui.window.physicalSize.height;
// ui.window.physicalSize
return WidgetsBinding
.instance.platformDispatcher.views.first.physicalSize.height;
}

double get appWidth {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: Zerker is a flexible and lightweight flutter canvas graphic animati
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.2.6
version: 2.3.1
homepage: https://github.com/flutterkit/zerker

environment:
Expand Down

0 comments on commit c0ce50e

Please sign in to comment.