Want to know about Flutter Container?

Want to know about Flutter Container?

Nafis Hasrat Arnob | September 21, 2022

Hello Developers,

These short notes will guide you with the knowledge of Flutter Container, which is the most important part of the Flutter App Development Journey. Let's see the article carefully.

Container widgets are commonly used for sizing and positioning other widgets. A container usually holds one child's widget. But if we put Column, Row, Stack, or other multiple children holding widgets we can pub many widgets under one container. We can place that container anywhere on the screen according to our convenience. The container has a lot of properties. Some useful ones are padding, margin, color, alignment, height, and width. Using margin we can define the distance from other widgets or the screen. Using padding we can define the distance of the child from the container border. We can give any color we want to that container using the color property. We can set the fixed height and width of a container using the height and width property. Elements of the Containers are: 


Container({Key key,
           AlignmentGeometry alignment, 
           EdgeInsetsGeometry padding, 
           Color color, 
           Decoration decoration, 
           Decoration foregroundDecoration, 
           double width, 
           double height, 
           BoxConstraints constraints, 
           EdgeInsetsGeometry margin, 
           Matrix4 transform, 
           Widget child, 
           Clip clipBehavior: Clip.none});


Now see the example:


child: const Text("This is a container",
style: TextStyle(color: Colors.white)),
	padding: EdgeInsets.all(10),
	margin: EdgeInsets.all(5),
	height: 200,
	width: 200,


Hope this will help you with the journey of Flutter Development.


Read More: Did you know the basics of Flutter Scaffold?

Nafis Hasrat Arnob

Nafis Hasrat Arnob

Information Analyst

I am a Flutter developer working for a reputed company in Bangladesh. I am trying my best to gain proficiency in Software Development. I am also interested in Artificial Intelligence, Machine Learning, and Computer Vision.