A container widget is same as <div> tag in html.
The container in Flutter is a main widget thai is parent widget.
It can contain multiple child widgets and manage them efficiently through width, height, padding, background color, etc.
Properties of Container widget
Let us learn some of the important properties of the container widget in detail.
- child: This property is used to store the child widget of the container.
- color: To set the background color of the text we use this property color . It also changes the entire container background.
- height and width: To set the container's height and width we use height and width property of container. To use value of width is double.infinity, it occupies the space as parent size.
- margin: It is used to put the empty space around the container.use EdgeInsets.all(25) propery that set the equal margin in all four directions.
- padding: Padding property is used to set the distance between the border of the container (all four directions) and its child widget. Here, we have used an EdgeInsets.all(25) that set the space between text and all four container directions.
- alignment: This attribute is used to set the position of the child within the container. Flutter allows some alignments such as center, bottom, bottom center, topLeft, centerRight, left, right, and etc…
- transform: This property is used to allows developers to rotate the container. It can rotate the container in any direction.