当前位置:网站首页>Fleet tutorial 13 basic introduction to listview's most commonly used scroll controls (tutorial includes source code)

Fleet tutorial 13 basic introduction to listview's most commonly used scroll controls (tutorial includes source code)

2022-07-06 17:51:00 Knowledge fatness

Flet What is it?

Flet It's a framework , Make it easy for you to build real-time in your favorite language Web、 Mobile and desktop applications , And share them safely with your team . No front-end experience .

What is? ListView

ListView Is the most commonly used scroll control . It displays its children one by one in the scrolling direction . On the cross axis , Children need to be filled ListView.

Combat code

from time import sleep
import flet
from flet import ListView, Page, Text

def main(page: Page):
    page.title = "Auto-scrolling ListView"

    lv = ListView(expand=1, spacing=10, padding=20, auto_scroll=True)

    count = 1

    for i in range(0, 60):
        lv.controls.append(Text(f"Line {count}"))
        count += 1

    page.add(lv)

    for i in range(0, 60):
        sleep(1)
        lv.controls.append(Text(f"Line {count}"))
        count += 1
        page.update()

flet.app(target=main)

Parameters

  • controls
    Control To be in ListView Shown in s list .

  • horizontal
    True Horizontal layout ListView project .

  • spacing
    ListView Between items Divider Height . If not specified , Then there is no space between items .

  • divider_thickness
    If it is greater than 0 be Divider Used as a ListView The spacing between items .

  • padding
    Amount of space to insert subitems .

For more information and possible values , Please see the Container.padding attribute .

  • auto_scroll
    True If the child is updated, the scroll bar should automatically move its position to the end .

  • item_extent
    horizontal Fixed height or width of the item used to optimize rendering ( about ListView).

  • first_item_prototype
    True If the size of the first item should be used for all other items “ Prototype ”, That is, their height or width will be the same as the first item . The default is False.

原网站

版权声明
本文为[Knowledge fatness]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/187/202207060941512939.html