Skip to content

Commit

Permalink
Improve web performance by implementing MediaQuery as InheritedModel
Browse files Browse the repository at this point in the history
  • Loading branch information
saravananmam authored and TechnoPrashant committed Nov 19, 2024
1 parent fefd682 commit 1d2ae92
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ class Device {
height = boxConstraints.maxHeight;

// Calculates remaining available size after `SafeArea`
final viewPadding = MediaQuery.of(context).viewPadding;
// final viewPadding = MediaQuery.viewPaddingOf(context);
// final viewPadding = MediaQuery.of(context).viewPadding;
final viewPadding = MediaQuery.viewPaddingOf(context);
safeWidth = width - (viewPadding.left + viewPadding.right);
safeHeight = height - (viewPadding.top + viewPadding.bottom);

// Sets aspect and pixel ratio
aspectRatio = constraints.constrainDimensions(width, height).aspectRatio;
pixelRatio = MediaQuery.of(context).devicePixelRatio;
// pixelRatio = MediaQuery.devicePixelRatioOf(context);
pixelRatio = MediaQuery.devicePixelRatioOf(context);

// Sets DeviceType
if (kIsWeb) {
Expand Down

0 comments on commit 1d2ae92

Please sign in to comment.