How to use the kivymd.list.BaseListItem function in kivymd

To help you get started, we’ve selected a few kivymd examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AndreMiras / KivyMD / kivymd / list.py View on Github external
class ThreeLineListItem(BaseListItem):
    '''
    A three line list item
    '''
    _txt_top_pad = NumericProperty(dp(16))
    _txt_bot_pad = NumericProperty(dp(15))  # dp(20) - dp(5)
    _num_lines = 3

    def __init__(self, **kwargs):
        super(ThreeLineListItem, self).__init__(**kwargs)
        self.height = dp(88)


class OneLineAvatarListItem(ContainerSupport, BaseListItem):
    _txt_left_pad = NumericProperty(dp(72))
    _txt_top_pad = NumericProperty(dp(20))
    _txt_bot_pad = NumericProperty(dp(19))  # dp(24) - dp(5)
    _num_lines = 1

    def __init__(self, **kwargs):
        super(OneLineAvatarListItem, self).__init__(**kwargs)
        self.height = dp(56)


class TwoLineAvatarListItem(OneLineAvatarListItem):
    _txt_top_pad = NumericProperty(dp(20))
    _txt_bot_pad = NumericProperty(dp(15))  # dp(20) - dp(5)
    _num_lines = 2

    def __init__(self, **kwargs):
github AndreMiras / KivyMD / kivymd / navigationdrawer.py View on Github external
def add_widget(self, widget, index=0):
        '''
        If the widget is a subclass of :class:`~NavigationDrawerHeaderBase`, then it will be placed above the
        :class:`~kivy.uix.scrollview.ScrollView`. Otherwise, it will be placed in the main
        :class:`~kivy.uix.scrollview.ScrollView` content area.
        '''
        if issubclass(widget.__class__, BaseListItem):
            self._list.add_widget(widget, index)
            if len(self._list.children) == 1:
                widget._active = True
                self.active_item = widget
            widget.bind(on_release=lambda x: self.panel.toggle_state())
            widget.bind(on_release=lambda x: x._set_active(True, list=self))
        elif issubclass(widget.__class__, NavigationDrawerHeaderBase):
            self._header_container.add_widget(widget)
        else:
            super(MDNavigationDrawer, self).add_widget(widget, index)
github AndreMiras / KivyMD / kivymd / list.py View on Github external
def remove_widget(self, widget):
        super(BaseListItem, self).remove_widget(widget)
        if widget in self._touchable_widgets:
            self._touchable_widgets.remove(widget)
github AndreMiras / KivyMD / demos / kitchen_sink / main.py View on Github external
def add_widget(self, widget, index=0):
        if issubclass(widget.__class__, BaseListItem):
            self._list.add_widget(widget, index)
            if len(self._list.children) == 1:
                widget._active = True
                self.active_item = widget
            # widget.bind(on_release=lambda x: self.panel.toggle_state())
            widget.bind(on_release=lambda x: x._set_active(True, list=self))
        elif issubclass(widget.__class__, NavigationDrawerHeaderBase):
            self._header_container.add_widget(widget)
        else:
            super(MDNavigationDrawer, self).add_widget(widget, index)
github mobile-insight / mobileinsight-mobile / app / kivymd / navigationdrawer.py View on Github external
def add_widget(self, widget, index=0):
        '''
        If the widget is a subclass of :class:`~NavigationDrawerHeaderBase`, then it will be placed above the
        :class:`~kivy.uix.scrollview.ScrollView`. Otherwise, it will be placed in the main
        :class:`~kivy.uix.scrollview.ScrollView` content area.
        '''
        if issubclass(widget.__class__, BaseListItem):
            self._list.add_widget(widget, index)
            if len(self._list.children) == 1:
                widget._active = True
                self.active_item = widget
            widget.bind(on_release=lambda x: self.panel.toggle_state())
            widget.bind(on_release=lambda x: x._set_active(True, list=self))
        elif issubclass(widget.__class__, NavigationDrawerHeaderBase):
            self._header_container.add_widget(widget)
        else:
            super(MDNavigationDrawer, self).add_widget(widget, index)
github AndreMiras / KivyMD / kivymd / list.py View on Github external
def propagate_touch_to_touchable_widgets(self, touch, touch_event, *args):
        triggered = False
        for i in self._touchable_widgets:
            if i.collide_point(touch.x, touch.y):
                triggered = True
                if touch_event == 'down':
                    i.on_touch_down(touch)
                elif touch_event == 'move':
                    i.on_touch_move(touch, *args)
                elif touch_event == 'up':
                    i.on_touch_up(touch)
        return triggered


class OneLineListItem(BaseListItem):
    '''
    A one line list item
    '''
    _txt_top_pad = NumericProperty(dp(16))
    _txt_bot_pad = NumericProperty(dp(15))  # dp(20) - dp(5)
    _num_lines = 1

    def __init__(self, **kwargs):
        super(OneLineListItem, self).__init__(**kwargs)
        self.height = dp(48)


class TwoLineListItem(BaseListItem):
    '''
    A two line list item
    '''
github AndreMiras / KivyMD / kivymd / list.py View on Github external
self.height = dp(48)


class TwoLineListItem(BaseListItem):
    '''
    A two line list item
    '''
    _txt_top_pad = NumericProperty(dp(20))
    _txt_bot_pad = NumericProperty(dp(15))  # dp(20) - dp(5)

    def __init__(self, **kwargs):
        super(TwoLineListItem, self).__init__(**kwargs)
        self.height = dp(72)


class ThreeLineListItem(BaseListItem):
    '''
    A three line list item
    '''
    _txt_top_pad = NumericProperty(dp(16))
    _txt_bot_pad = NumericProperty(dp(15))  # dp(20) - dp(5)
    _num_lines = 3

    def __init__(self, **kwargs):
        super(ThreeLineListItem, self).__init__(**kwargs)
        self.height = dp(88)


class OneLineAvatarListItem(ContainerSupport, BaseListItem):
    _txt_left_pad = NumericProperty(dp(72))
    _txt_top_pad = NumericProperty(dp(20))
    _txt_bot_pad = NumericProperty(dp(19))  # dp(24) - dp(5)
github AndreMiras / KivyMD / kivymd / list.py View on Github external
class OneLineListItem(BaseListItem):
    '''
    A one line list item
    '''
    _txt_top_pad = NumericProperty(dp(16))
    _txt_bot_pad = NumericProperty(dp(15))  # dp(20) - dp(5)
    _num_lines = 1

    def __init__(self, **kwargs):
        super(OneLineListItem, self).__init__(**kwargs)
        self.height = dp(48)


class TwoLineListItem(BaseListItem):
    '''
    A two line list item
    '''
    _txt_top_pad = NumericProperty(dp(20))
    _txt_bot_pad = NumericProperty(dp(15))  # dp(20) - dp(5)

    def __init__(self, **kwargs):
        super(TwoLineListItem, self).__init__(**kwargs)
        self.height = dp(72)


class ThreeLineListItem(BaseListItem):
    '''
    A three line list item
    '''
    _txt_top_pad = NumericProperty(dp(16))