flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
10.8k stars 416 forks source link

Sticky Footer ScrollView #3623

Open bl1nch opened 1 month ago

bl1nch commented 1 month ago

Duplicate Check

Describe the requested feature

It is not possible to create a widget that will snap to the end of the page if the height of the page content is less than the height of the window, but will also scroll with the content if there is not enough space.

This issue occurs because any Control with expand = true in a scrollable Column becomes infinite.

Example in Flutter: https://pub.dev/packages/sticky_footer_scrollview

Suggest a solution

No response

Screenshots

demo1 demo3

Additional details

No response

ndonkoHenri commented 1 month ago

Example of sticky footer:


import flet as ft

def main(page: ft.Page):
    page.padding = ft.Padding(10, 10, 10, 0)  # remove the bottom padding
    page.add(
        ft.Column(
            [
                ft.ListTile(
                    title=ft.Text(f"Item {i}"),
                    bgcolor=ft.colors.GREEN_ACCENT_400,
                )
                for i in range(50)
            ],
            scroll=ft.ScrollMode.ALWAYS,
            expand=True,
        ),
        ft.ListTile(title=ft.Text("I stick to the bottom!"), bgcolor=ft.colors.BLUE),
    )

ft.app(main)
bl1nch commented 1 month ago

Example of sticky footer:

import flet as ft

def main(page: ft.Page):
    page.padding = ft.Padding(10, 10, 10, 0)  # remove the bottom padding
    page.add(
        ft.Column(
            [
                ft.ListTile(
                    title=ft.Text(f"Item {i}"),
                    bgcolor=ft.colors.GREEN_ACCENT_400,
                )
                for i in range(50)
            ],
            scroll=ft.ScrollMode.ALWAYS,
            expand=True,
        ),
        ft.ListTile(title=ft.Text("I stick to the bottom!"), bgcolor=ft.colors.BLUE),
    )

ft.app(main)

Sorry but that's not exactly what I meant. Sticky footer should also scroll with the content in the column if there is not enough free space on the page, and should only stick to the bottom if there is free space between the content in the column and the footer