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
11.59k stars 454 forks source link

remove AdjustableScrollController() #4145

Closed OwenMcDonnell closed 1 month ago

OwenMcDonnell commented 1 month ago

Description

Removal of conditional assignment of scrollController in Grid View widget. Fixes #3963

Test Code

import flet as ft

def main(page: ft.Page):
    page.title = "GridView Example"
    page.theme_mode = ft.ThemeMode.DARK
    page.padding = 50
    page.update()

    images = ft.GridView(
        expand=1,
        runs_count=5,
        max_extent=150,
        child_aspect_ratio=1.0,
        spacing=5,
        run_spacing=5
    )

    page.add(images)

    for i in range(0, 60):
        images.controls.append(
            ft.Image(
                src=f"https://picsum.photos/150/150?{i}",
                fit=ft.ImageFit.NONE,
                repeat=ft.ImageRepeat.NO_REPEAT,
                border_radius=ft.border_radius.all(10),
            )
        )
    page.update()

ft.app(main)

Type of change

Checklist:

Summary by Sourcery

Remove the use of AdjustableScrollController and replace it with ScrollController in GridView, ListView, and ScrollableControl widgets to simplify the scroll controller logic and fix related issues.

Bug Fixes:

Enhancements:

ndonkoHenri commented 5 days ago

@sourcery-ai review