New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactoring List code to remove lots of internal state that caused some render issues #1961
Conversation
…me render issues I could not track down the issues directly, so imported Tree/Table style code to render with simpler code. Fixes fyne-io#1948, fyne-io#1960
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a couple comments for possible code improvements. Apart from that, it seems to be working fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me but probably good if someone more has a look as well.
widget/list.go
Outdated
} else { | ||
objects[len(objects)-1].Move(fyne.NewPos(0, 0)) | ||
func (l *listLayout) setupListItem(item fyne.CanvasObject, id ListItemID) { | ||
li := item.(*listItem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any particular reason to receive a fyne.CanvasObject instead of directly a *listItem
? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, a hangover from old code - thanks
li.selected = false | ||
for _, s := range l.list.selected { | ||
if id == s { | ||
li.selected = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is setting up a single list item, wouldn't it be more efficient to break the loop when the list item selected was found?
I could not track down the issues directly, so imported Tree/Table style code to render with simpler code.
TODO:
Fixes #1948, #1960
Checklist: