How to get the width of the screen?

This Article is posted by seven.srikanth at 29-07-2018 12:20:57

Below code will help you to get the width of the screen in flutter.
double width = MediaQuery.of(context).size.width
Here is an example of how we can get width in widgets,
new Container(
constraints: new BoxConstraints.expand(
width: MediaQuery.of(context).size.width - 20,
padding: const EdgeInsets.all(8.0),
color: Colors.teal.shade700,
child: new Text('Hello World',
style: Theme.of(context).textTheme.display1.copyWith(color: Colors.white)),
Hope this is useful. 

Tags: How to get the width of the screen in flutter?; Width of mobile Screen;

Login to comment.
Recent Comments

Be the first to Comment. You can ask a Query or Share your toughts or Just say thanks.

Recent Articles

How to deploy flutter web site on GitHub using peanut

Posted by nikhilchaudhary12155 on 13 Oct 2019 Article

AnimatedPositioned Widget Example in Flutter

Posted by seven.srikanth on 10 Oct 2019 Article

Flutter Open-Source and directory lists

Posted by nishantkotatech on 09 Oct 2019 Article

Flutter Travelling Couple Leading Page - Flutter Web Series 3

Posted by nikhilchaudhary12155 on 05 Oct 2019 Article

© 2018 - Fluttercentral | Email to me -