<p>You can get the width and height of the Screen through MediaQuery.Size property. Here is the code snippet from which you can get the width and height of the screen of the phone. color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre-wrap;](color: #569cd6;](final sizeX = MediaQuery.of(context).size.width;color: #569cd6;](final sizeY = MediaQuery.of(context).size.height; Here is a sample example of how to use it in a program. color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Consolas, "Courier New", monospace; font-size: 14px; line-height: 19px; white-space: pre-wrap;](color: #569cd6;](import color: #ce9178;]('package:flutter/material.dart'; color: #569cd6;](void main() => runApp(MyApp()); color: #569cd6;](class MyApp color: #569cd6;](extends StatelessWidget { color: #569cd6;](@override Widget build(BuildContext context) { color: #569cd6;](return MaterialApp( home: Scaffold( appBar: AppBar( title: Text(color: #ce9178;]('Rows and Columns'), ), body: Home(), ), ); }} color: #569cd6;](class Home color: #569cd6;](extends StatelessWidget { color: #569cd6;](@override Widget build(BuildContext context) { color: #569cd6;](final sizeX = MediaQuery.of(context).size.width; color: #569cd6;](final sizeY = MediaQuery.of(context).size.height; color: #569cd6;](return Container( color: Colors.red, width: sizeX, height: sizeY, child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Text(color: #ce9178;]('Width: $sizeX' ), Text(color: #ce9178;]('HeiGht: $sizeY' ), ], ) ); }} Hope this helps.Thanks,Srikanth</p>
How to get the Width and Height of the Screen in Flutter?
This Article is posted by seven.srikanth at 8/16/2019 3:18:14 PM
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter
Tags: Container; Mediaquery; height; width; screen; size
Check out our other latest articles
Safearea widget - How to avoid visual overlap with Notch on flutter mobile app?How to convert row of widgets into column of widgets in flutter based on screen size?
How to run Flutter programs from GitHub?
How to get screen orientation in flutter?
NavigationRail example in flutter