Closed ikus060 closed 6 months ago
Thanks. Also note that the bug is in two places:
https://github.com/kivymd/KivyMD/blob/master/kivymd/uix/list/list.kv#L69 https://github.com/kivymd/KivyMD/blob/master/kivymd/uix/list/list.kv#L78
@HeaTTheatR I don't see any problem on line 69. The condition is working fine with or without children.
@HeaTTheatR I don't see any problem on line 69. The condition is working fine with or without children.
<MDListItem>
...
BoxLayout:
...
AnchorLayout:
...
BoxLayout:
...
on_children:
if leading_container.children: \
leading_container.children[0].pos_hint = {"top": 1} \
if len(args[1]) == 3 else {"center_y": .5}
BoxLayout:
...
on_children:
if text_container.children: \
self.children[0].pos_hint = {"top": 1} \
if len(text_container.children) == 3 else {"center_y": .5}
@HeaTTheatR Sorry, but you will need to be more explicit if you think there is an issue with line 69.
According to me the current condition on line 69 if leading_container.children
will not lead to an exception if the container has or has no children.
On the contrary, the trailing_container
boxlayout has an issue, because the on_children
rule make reference to self.children[0]
which is not checked upon.
Description of the problem
When trying to remove the MDListItemTrailingIcon from a MDListItem an exception is raised. See #1644.
Describe the algorithm of actions that leads to the problem
See #1644.
Description of Changes
Add extra condition to avoid raising KeyError.
I did not write unit test since I did not see any testing done for MDList in general.
Screenshots of the solution to the problem
N/A
Code for testing new changes
N/A