9. Flutter - Layouts/Containers/Padding/Margins

Containers/Layouts usually go into a "body: " property.


Container Widgets:

Container()


Container Properties:

padding // used to specify paddings

margin // used to specify margin

color

child


Margin vs Padding:

- margin is for the outside of the container

- padding is for the inside of the container


Padding Property:

padding: EdgeInsets.PADDINGMETHODNAME


PADDINGMETHODNAMES:

All(float) // equal padding on all sides.

symmetric(horizontal: float, vertical: float) // equal padding on two parameter mirrors

fromLTRB(float,float,float,float) // left, top, right, bottom separate values for padding


Padding Widget (for individual widgets like a text widget. use in-place of a container):

Padding(

padding: EdgeInsets.all(50.0)

child: Text("HELLO")

)


Margin Property:

margin: EdgeInsets.MARGINMETHODNAME


MARGINMETHODNAMES:

All(float) // equal margin on all sides.

symmetric(horizontal: float, vertical: float) // equal margin on two parameter mirrors

fromLTRB(float,float,float,float) // left, top, right, bottom separate values for margin

Comments

Popular posts from this blog

2. FreeCodeCamp - Dynamic Programming - Learn to Solve Algorithmic Problems & Coding Challenges

20. Data Analytics - Analyze Data to Answer Questions - Week 1

3. Algorithms - Selection Sort