def add_item(self, text, callback, icon=None): if icon: item = OneLineIconListItem(text=text, on_release=callback) item.add_widget(ListBSIconLeft(icon=icon)) else: item = OneLineListItem(text=text, on_release=callback) item.bind(on_release=lambda x: self.dismiss()) self.mlist.add_widget(item)
def add_item(self, text, callback, icon=None): """ :arg text: element text; :arg callback: function that will be called when clicking on an item; :arg icon_src: which will be used as an icon to the left of the item; """ if icon: item = OneLineIconListItem(text=text, on_release=callback) item.add_widget(ListBottomSheetIconLeft(icon=icon)) else: item = OneLineListItem(text=text, on_release=callback) item.bind(on_release=lambda x: self.dismiss()) self.sheet_list.ids.box_sheet_list.add_widget(item)