Flutter MediaQuery

2023-04-17  本文已影响0人  Sunooo

直接看代码案例快速入手Flutter

本文介绍MediaQuery.

MediaQuery主要用于获取当前设备的一些参数。

🎉下载GitHub仓库,直接体验

MediaQuery

double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height;
Orientation orientation = MediaQuery.of(context).orientation;
double devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
double statusBarHeight = MediaQuery.of(context).padding.top;
double bottomBarHeight = MediaQuery.of(context).padding.bottom;
double textScaleFactor = MediaQuery.of(context).textScaleFactor;
Brightness brightness = MediaQuery.of(context).platformBrightness;
上一篇 下一篇

猜你喜欢

热点阅读