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

absolute-positioned problem? #290

Closed
scriptiot-dev opened this issue Sep 8, 2022 · 3 comments
Closed

absolute-positioned problem? #290

scriptiot-dev opened this issue Sep 8, 2022 · 3 comments

Comments

@scriptiot-dev
Copy link

scriptiot-dev commented Sep 8, 2022

class Stack(ConstrainedControl):
    def __init__(
        self,
        controls: Optional[List[Control]] = None,
        ref: Optional[Ref] = None,
        width: OptionalNumber = None,
        height: OptionalNumber = None,
        left: OptionalNumber = None,
        top: OptionalNumber = None,
        right: OptionalNumber = None,
        bottom: OptionalNumber = None,
        expand: Union[None, bool, int] = None,
        opacity: OptionalNumber = None,
        rotate: RotateValue = None,
        scale: ScaleValue = None,
        offset: OffsetValue = None,
        animate_opacity: AnimationValue = None,
        animate_size: AnimationValue = None,
        animate_position: AnimationValue = None,
        animate_rotation: AnimationValue = None,
        animate_scale: AnimationValue = None,
        animate_offset: AnimationValue = None,
        visible: Optional[bool] = None,
        disabled: Optional[bool] = None,
        data: Any = None,
        #
        # Stack-specific
        #
        clip_behavior: ClipBehavior = None,
    ):
import flet
from flet import Column, Container, Page, Stack, colors


def main(page: Page):
    page.add(
        Stack([Container(
            border_radius=8,
            padding=5,
            width=100,
            height=100,
            left=20,
            top=20,
            bgcolor=colors.BLACK,
        )],
        width=200,
        height=200,
        left=20,
        top=20,
        )
    )


flet.app(target=main)


can't set left/top for Stack ?

left: OptionalNumber = None,
top: OptionalNumber = None,
right: OptionalNumber = None,
bottom: OptionalNumber = None

how to used?

@scriptiot-dev
Copy link
Author

scriptiot-dev commented Sep 8, 2022

All widgets inherit from ConstrainedControl has

left: OptionalNumber = None,
top: OptionalNumber = None,
right: OptionalNumber = None,
bottom: OptionalNumber = None

But set left/top is not work ;

I test container in stack is ok , all other may not wok

import flet
from flet import Page, Text, colors


def main(page: Page):
    page.title = "Text custom styles"
    page.scroll = "adaptive"
    page.add(
        Text("Size 10", size=10, left=300, top=100)
    )


flet.app(target=main)

is any code used wrong?

@FeodorFitsner
Copy link
Contributor

left, top, right and bottom works inside Stack only.

Working example:

import flet
from flet import Page, Stack, Text, colors

def main(page: Page):
    page.title = "Text custom styles"
    page.scroll = "adaptive"
    page.add(Stack([Text("Size 10", size=10, left=300, top=100)], expand=True))

flet.app(target=main)

@FeodorFitsner
Copy link
Contributor

I'm closing this issue in favor of #296

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

No branches or pull requests

2 participants