import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'dart:ui' as ui show window; class Screen { static double get width { MediaQueryData mediaQuery = MediaQueryData.fromView(ui.window); return mediaQuery.size.width; } static double get height { MediaQueryData mediaQuery = MediaQueryData.fromView(ui.window); return mediaQuery.size.height; } static double get scale { MediaQueryData mediaQuery = MediaQueryData.fromView(ui.window); return mediaQuery.devicePixelRatio; } static double get textScaleFactor { MediaQueryData mediaQuery = MediaQueryData.fromView(ui.window); return mediaQuery.textScaleFactor; } static double get navigationBarHeight { MediaQueryData mediaQuery = MediaQueryData.fromView(ui.window); return mediaQuery.padding.top + kToolbarHeight; } static double get topSafeHeight { MediaQueryData mediaQuery = MediaQueryData.fromView(ui.window); return mediaQuery.padding.top; } static double get bottomSafeHeight { MediaQueryData mediaQuery = MediaQueryData.fromView(ui.window); return mediaQuery.padding.bottom; } static updateStatusBarStyle(SystemUiOverlayStyle style) { SystemChrome.setSystemUIOverlayStyle(style); } }