Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any control can be positioned absolutely inside Stack #60

Merged
merged 1 commit into from
Jul 8, 2022

Conversation

FeodorFitsner
Copy link
Contributor

@FeodorFitsner FeodorFitsner commented Jul 8, 2022

All visible controls got 4 new properties:

  • left
  • top
  • right
  • bottom

Example code:

import flet
from flet import Container, Page, Stack, colors
from flet.column import Column

def main(page: Page):

    page.horizontal_alignment = "center"
    page.vertical_alignment = "center"

    page.add(
        Container(
            Stack(
                [
                    Container(width=20, height=20, bgcolor=colors.RED, border_radius=5),
                    Container(
                        width=20,
                        height=20,
                        bgcolor=colors.YELLOW,
                        border_radius=5,
                        right=0,
                    ),
                    Container(
                        width=20,
                        height=20,
                        bgcolor=colors.BLUE,
                        border_radius=5,
                        right=0,
                        bottom=0,
                    ),
                    Container(
                        width=20,
                        height=20,
                        bgcolor=colors.GREEN,
                        border_radius=5,
                        left=0,
                        bottom=0,
                    ),
                    Column(
                        [
                            Container(
                                width=20,
                                height=20,
                                bgcolor=colors.PURPLE,
                                border_radius=5,
                            )
                        ],
                        left=35,
                        top=35,
                    ),
                ]
            ),
            border_radius=8,
            padding=5,
            width=100,
            height=100,
            bgcolor=colors.BLACK,
        )
    )

flet.app(target=main)

Result:

image

All visible controls got 4 new properties:
- left
- top
- right
- bottom
@FeodorFitsner FeodorFitsner merged commit c7333dc into main Jul 8, 2022
@FeodorFitsner FeodorFitsner deleted the positioned branch July 8, 2022 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant