Padding
Defines padding for all sides of a rectangle.
Properties
Methods
Properties
bottomclass-attributeinstance-attribute
bottom: Number = 0The padding value for the bottom side of the rectangle.
leftclass-attributeinstance-attribute
left: Number = 0The padding value for the left side of the rectangle.
Methods
onlyclassmethod
Applies padding to the specified sides.
symmetricclassmethod
Applies vertical padding to top and bottom sides and horizontal padding to left and right sides.
zeroclassmethod
zero(cls)Examples
Example 1
import flet as ft
def main(page: ft.Page):
page.title = "Containers with different padding"
page.add(
ft.SafeArea(
content=ft.Column(
controls=[
ft.Row(
controls=[
ft.Container(
content=ft.Button("container_1"),
bgcolor=ft.Colors.AMBER,
padding=ft.Padding.all(10),
width=150,
height=150,
),
ft.Container(
content=ft.Button("container_2"),
bgcolor=ft.Colors.AMBER,
padding=ft.Padding.all(20),
width=150,
height=150,
),
ft.Container(
content=ft.Button("container_3"),
bgcolor=ft.Colors.AMBER,
padding=ft.Padding.symmetric(horizontal=10),
width=150,
height=150,
),
ft.Container(
content=ft.Button("container_4"),
bgcolor=ft.Colors.AMBER,
padding=ft.Padding.only(left=10),
width=150,
height=150,
),
]
)
],
),
)
)
if __name__ == "__main__":
ft.run(main)
