Box Model

The term "Box Model" is used when talking about design and layout.

Flutter Box Model

Explanation of the different parts:

  • Content : The content of the box, where text and images appear.

  • Padding : Clears an area around the content. The padding is transparent

  • Border : A border that goes around the padding and content

  • Margin : Clears an area outside the border. The margin is transparent


Example :

         Container(

            child: Text("Content"),

            width: 350,

            height: 100,

            padding: EdgeInsets.all(25),

            margin: EdgeInsets.only(right: 20, top: 50),

            decoration: BoxDecoration(

                border: Border.all(width: 2, color: Colors.pink)),

          )



Flutter Box Model Example