Border
A border comprised of four sides: top, right, bottom, left.
Each side of the border is an instance of
BorderSide.
Properties
- 
          bottom(BorderSide) –Bottom side of the border. 
- 
          left(BorderSide) –Left side of the border. 
- 
          right(BorderSide) –Right side of the border. 
- 
          top(BorderSide) –Top side of the border. 
Methods
- 
            all–Creates a border whose sides are all the same. 
- 
            copy–Returns a copy of this object with the specified properties overridden. 
- 
            only–Creates a Borderfrom the given values.
- 
            symmetric–Creates a border with symmetrical vertical and horizontal sides. 
Properties#
class-attribute
      instance-attribute
  
#
bottom: BorderSide = field(default_factory=lambda: none())
Bottom side of the border.
class-attribute
      instance-attribute
  
#
left: BorderSide = field(default_factory=lambda: none())
Left side of the border.
class-attribute
      instance-attribute
  
#
right: BorderSide = field(default_factory=lambda: none())
Right side of the border.
class-attribute
      instance-attribute
  
#
top: BorderSide = field(default_factory=lambda: none())
Top side of the border.
Methods#
classmethod
  
#
all(
    width: Number | None = None,
    color: ColorValue | None = None,
    side: BorderSide | None = None,
) -> Border
Creates a border whose sides are all the same.
If side is not None, it gets used and both width and color are ignored.
copy(
    *,
    left: BorderSide | None = None,
    top: BorderSide | None = None,
    right: BorderSide | None = None,
    bottom: BorderSide | None = None,
) -> Border
Returns a copy of this object with the specified properties overridden.
classmethod
  
#
only(
    *,
    left: BorderSide | None = None,
    top: BorderSide | None = None,
    right: BorderSide | None = None,
    bottom: BorderSide | None = None,
) -> Border
Creates a Border from the given values.
classmethod
  
#
symmetric(
    *,
    vertical: BorderSide | None = None,
    horizontal: BorderSide | None = None,
) -> Border
Creates a border with symmetrical vertical and horizontal sides.
The vertical argument applies to the left and right sides,
and the horizontal argument applies to the top and bottom sides.
Examples#
Example 1#
import flet as ft
def main(page: ft.Page):
    page.title = "Containers with different borders"
    page.add(
        ft.Row(
            controls=[
                ft.Container(
                    bgcolor=ft.Colors.AMBER,
                    padding=15,
                    border=ft.Border.all(10, ft.Colors.PINK_600),
                    border_radius=ft.border_radius.all(30),
                    width=150,
                    height=150,
                ),
                ft.Container(
                    bgcolor=ft.Colors.DEEP_PURPLE,
                    padding=15,
                    border=ft.Border.all(3, ft.Colors.LIGHT_GREEN_ACCENT),
                    border_radius=ft.border_radius.only(top_left=10, bottom_right=10),
                    width=150,
                    height=150,
                ),
                ft.Container(
                    bgcolor=ft.Colors.BLUE_GREY_900,
                    padding=15,
                    border=ft.Border.symmetric(
                        vertical=ft.BorderSide(8, ft.Colors.YELLOW_800)
                    ),
                    width=150,
                    height=150,
                ),
            ]
        )
    )
ft.run(main)