What is a MediaQuery in Flutter and when do we use it?

Technology CommunityCategory: FlutterWhat is a MediaQuery in Flutter and when do we use it?
VietMX Staff asked 3 years ago
  • MediaQuery provides a higher-level view of your app’s screen size and can provide more detailed information about user layout preferences.
  • You just access it by MediaQuery.of() in your method.
  • With MediaQuery you can obtain information like: – Device the app is running on – Size of the screen – Device orientation – Check for default font size – Accessibility information – User preferences like screen contrast, animations etc.
  • MediaQuery are usually used when we want to have different UI layouts, animations, fonts, etc for different screens and according to users preferences.