04-Apr-2022
.
Admin
Hi friends,
In this post, we will learn How To get Flutter screen size. i explained simply step by step How to Determine Screen Height and Width - flutter. Here you will learn Simple How to get screen width and screen height. This tutorial will give you simple example How to flutter get width of screen.
I will give you simple Example of How to get Device Screen Size 'Height and Width' in Flutter App.
So let's see bellow example:
import 'package:flutter/material.dart';
void main(){
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "My Flutter Tutorials",
home: Home(),
);
}
}
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State
{ @override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Get Screen Size"),
),
body: Column(
children:
[ Container(
height: (MediaQuery.of(context).size.height),
width: (MediaQuery.of(context).size.width),
color: Colors.yellow,
)
],
),
);
}
}
Output
I hope it will help you....
#Flutter