Sunday, 13 June 2021

KivyMD Ripple Behavior Not Working Correctly

I am making this desktop app and I realized a weird bug. I have defined two MDRectangleFaltButton and MDRaisedButtons and the long ripple effects do not seem to be working correctly. At first I thought that it was because it was inside a tab but then I separately tried it and it worked normally. I guess it could be because I used an MDNavigationRail alongside it and somehow it miscalculates things. Is there a way to fix this or how can I at least report it to the guys at kivymd? (I also seem to be getting a clock warning)

Ripple Behavior Working Incorrectly

My Code:

from kivy.config import Config

Config.set('graphics', 'width', '850')
Config.set('graphics', 'height', '530')
Config.set('graphics', 'minimum_width', '850')
Config.set('graphics', 'minimum_height', '530')
from kivy.lang import Builder
from kivymd.uix.card import MDCard
from kivymd.uix.tab import MDTabsBase
from kivymd.app import MDApp


class SettingsTab(MDCard, MDTabsBase):
    pass

class Example(MDApp):

    def __init__(self, **kwargs):
        super(Example, self).__init__(**kwargs)
        self.kv = Builder.load_string('''
#:kivy 2.0.0
<SettingsTab>:
    orientation: "vertical"
    size_hint: .95, .95
    pos_hint: {"center_x": .5, "center_y": .5}
    border_radius: 5
    radius: [5]
    elevation: 20
BoxLayout:
    MDNavigationRail:
        color_active: app.theme_cls.primary_color
        MDNavigationRailItem:
            icon: "list-status"
            on_release:
                screens.current = "downloads_screen"
        MDNavigationRailItem:
            icon: "cog"
            on_release:
                screens.current = "settings"
        MDNavigationRailItem:
            icon: "information"
            on_release:
                screens.current = "activity_log"

    ScreenManager:
        id: screens
        Screen:
            name: "downloads_screen"
        Screen:
            name: "activity_log"
        Screen:
            name: "settings"
            MDTabs:
                SettingsTab:
                    title: "DOWNLOAD"
                SettingsTab:
                    title: "COLOR"
                    MDBoxLayout:
                        adaptive_height: True
                        orientation: "vertical"
                        padding: 10
                        MDLabel:
                            text: "Theme Manager: "
                            font_style: "H5"
                            padding_y: 10
                            size_hint_y: None
                            height: self.texture_size[1]
                        MDBoxLayout:
                            adaptive_height: True
                            spacing: 10
                            MDRectangleFlatButton:
                                text: "See Current Palette"
                                size_hint_x: .5
                            MDRaisedButton:
                                text: "Open Theme Picker"
                                size_hint_x: .5
                SettingsTab:
                    title: "INFO"''')

    def build(self):
        self.theme_cls.theme_style = "Dark"
        self.theme_cls.primary_palette = "Blue"
        self.theme_cls.accent_palette = "Teal"
        return self.kv


if __name__ == '__main__':
    Example().run()


from KivyMD Ripple Behavior Not Working Correctly

No comments:

Post a Comment