Sohu Tech Products
Aug 14, 2024 · Mobile Development
Understanding Flutter Status Bar Height: Why MediaQuery.padding.top Returns 0
In Flutter, MediaQuery.of(context).padding.top reports the system UI inset rather than the actual status‑bar height, and when a Scaffold (especially with an AppBar) consumes this padding the value becomes zero, so developers must read the raw view padding via WidgetsBinding or MediaQueryData.fromView to reliably obtain the status‑bar height.
AndroidMediaQueryMobile Development
0 likes · 5 min read