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

ResponsiveRow breakpoints should be able to adapt to its own size instead of page size #4870

Open
1 task done
jnsh opened this issue Feb 11, 2025 · 0 comments
Open
1 task done
Labels
feature request Suggestion/Request for additional feature

Comments

@jnsh
Copy link

jnsh commented Feb 11, 2025

Duplicate Check

Describe the requested feature

In situations where the ResponsiveRow does not extend to the whole width of the page/window, it would make more sense to have the col breakpoints compared to the ResposiveRow's own size, instead of the page size.

User defined breakpoints could help this somewhat, but are still not perfect solution:

Imagine case where e.g. half or the page width is used by Responsiverow, and half by something else (e.g. sidebars). In this case it is also possible to close the sidebars, which would increase the size allocated to ResponsiveRow. When the ResponsiveRow's size changes, you'd likely expect/want it to adapt the size of its children to its new size, but with the current implementation this does not happen.

Example code demonstrating the aforementioned issue:

import flet as ft

def main(page: ft.Page):

    def hide_button(e):
        button.visible = False
        page.update()

    button = ft.Container(
        content=ft.Text("Click to hide"),
        padding=100,
        alignment=ft.alignment.center,
        expand=True,
        on_click=hide_button,
    )

    row = ft.ResponsiveRow(expand=True)
    for i in range(28):
        row.controls.append(
            ft.Image(
                src=f"https://picsum.photos/150/150?{i}",
                col={"sm": 12, "md": 6, "lg": 4, "xl": 2, "xxl": 1},
            ),
        )

    page.add(
        ft.Row(
            controls=[
                row,
                button,
            ],
        )
    )

ft.app(main)

Suggest a solution

You could either add option to ResponsiveRow to check breakpoints against it's own size, or change the default behavior altogether.

Screenshots

No response

Additional details

No response

@jnsh jnsh changed the title ResponsiveRow should be able to adapt to its own size instead of page size ResponsiveRow breakpoints should be able to adapt to its own size instead of page size Feb 11, 2025
@ndonkoHenri ndonkoHenri added the feature request Suggestion/Request for additional feature label Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Suggestion/Request for additional feature
Projects
None yet
Development

No branches or pull requests

2 participants