-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fyne List Proposal
Stephen M Houston edited this page Jan 13, 2020
·
8 revisions
Using the upcoming Data API/Bindings we can begin to create widgets that can take advantage.
The most requested/needed of these widgets is likely a List.
- The list widget should be performant and to achieve that we have the following proposal:
- The list widget will have a scroller as parent
- The list widget will use a layout that determines the visible viewport of the scroller and only create/show the visible list items +/- 3 items above and below the visible area. This calculation can be done by determining the total number of list items through the data api and then determining the size of a list item. For instance - if the list has 100 items, and each item has a height of 20 pixels, the total height of the list will be 2000 pixels. If the visible viewport of the scroller is y = 100 and h = 200, we know the visible items that will be 100 / 20 (the item height) - which will be item 5, through 200 / 20 - will will be item 10. +/- 3 items above and below tells us that we will need to create list items 2 through 13.
- As the scroller scrolls this math can be redone and the objects can be reused and updated with the new list item content that we get from the data api. This will keep the list performant and allow it to easily handle large lists.
One question that remains - how should we determine a minimum width for the list items. Should be explicitly set by the developer? Should it be some maths based off of finding the largest list item and using it's width? Should it be ignored and allow the parent of the list to control? I.e. a max width layout would just expand it but being in a border on a border layout would make it unviewable?