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
9.43k stars 360 forks source link

Scrollbar thickness attribute works incorrect #3144

Closed sagittarius-H closed 2 weeks ago

sagittarius-H commented 2 weeks ago

Description

Thickness attribute only works when interacting with scrollbar (hover, scroll), otherwise scrollbar does not change its width.

Code example to reproduce the issue:

import flet

def main(page: flet.Page):

    page.horizontal_alignment = flet.CrossAxisAlignment.CENTER
    page.vertical_alignment = flet.MainAxisAlignment.CENTER

    page.add(
        flet.Stack(
            controls=[
                flet.Container(
                    content=flet.CircleAvatar(bgcolor="#e3e7e8", radius=6.5),
                    alignment=flet.alignment.bottom_right,
                ),
                flet.Container(
                    content=flet.CircleAvatar(bgcolor="#e3e7e8", radius=6.5),
                    alignment=flet.alignment.top_right,
                ),
                flet.Container(
                    content=flet.Column(
                        width=200,
                        height=80,
                        scroll=flet.ScrollMode.ALWAYS,
                        controls=[flet.Text(value=str(i)) for i in range(100)]
                    ),
                    theme=flet.Theme(
                        scrollbar_theme=flet.ScrollbarTheme(
                            track_color={
                                flet.MaterialState.DEFAULT: "#E3E7E8",
                            },
                            track_visibility=True,
                            thumb_color={
                                flet.MaterialState.DEFAULT: "#616161",
                            },
                            thickness=5,
                            radius=10,
                            main_axis_margin=5,
                            min_thumb_length=5,
                        )
                    ),
                    top=5
                ),
            ],
            width=200,
            height=90,
        )
    )

flet.app(target=main)

Describe the results you received:

https://github.com/flet-dev/flet/assets/148689567/c5bb3884-0501-4c32-90ad-e4d11e9d631b

Describe the results you expected:

When setting thickness attribute without explicitly specifying MaterialStates, scrollbar must always remain the same width.

Flet version (pip show flet):

Name: flet
Version: 0.22.0
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page: 
Author: Appveyor Systems Inc.
Author-email: hello@flet.dev
License: Apache-2.0
Location: C:\Users\HermanC\PycharmProjects\flet-Learn\venv\Lib\site-packages
Requires: cookiecutter, fastapi, flet-runtime, packaging, qrcode, uvicorn, watchdog
Required-by:

Give your requirements.txt file (don't pip freeze, instead give direct packages):

flet==0.22.0

Operating system:

Windows 11 21H2