KivyMD icon indicating copy to clipboard operation
KivyMD copied to clipboard

MDFloatingActionButtonSpeedDial does not work with MDNavigationRail

Open blurryrox opened this issue 1 year ago • 4 comments

So i am trying to add a MDFloatingActionButtonSpeedDial into a screen navigated through the MDNavigationRail items but it doesn't even show up.

When i try removing the MDNavigationRail part, the FAB shows up which i find weird, this may be a bug, or i am doing something wrong i am not sure. Here's my coede:

main.py:

from kivymd.app import MDApp
from kivy.uix.screenmanager import ScreenManager, Screen

class CfgScreen(Screen):    
    data = {
        "Add user": "account-plus-outline"
        }

    def __init__(self, **kwargs):
        super(CfgScreen, self).__init__(**kwargs)

class MainApp(MDApp):   

    def build(self):
        self.theme_cls.primary_palette = "Teal"
        sm = ScreenManager()
        sm.add_widget(CfgScreen(name="cfg"))

        return sm

if __name__=="__main__":
    MainApp().run()

main.kv

CfgScreen:

<CfgScreen>:
    name: "cfg"
    BoxLayout:
        orientation: "horizontal"
        MDNavigationRail:
            md_bg_color: app.theme_cls.primary_color
            MDNavigationRailItem:
                id: navigation_rail
                icon: "account-details-outline"
        ScreenManager:
            id: sm_cfg
            Screen:
                name: "cfg_user_account"
                MDFloatingActionButtonSpeedDial:
                    data: root.data
                    root_button_anim: True

Screenshots

With MDNavigationRail: wnav

Without the MDNavigationRail part: wonav

Versions

  • OS: Windows 10
  • Python: 3.10.6
  • Kivy: 2.1.0
  • KivyMD: 1.0.2

blurryrox avatar Aug 24 '22 15:08 blurryrox

@blurryrox Please change your code so that there is nothing in it that does not relate to reproducing the error.

HeaTTheatR avatar Aug 24 '22 16:08 HeaTTheatR

@blurryrox Please change your code so that there is nothing in it that does not relate to reproducing the error.

edited

blurryrox avatar Aug 24 '22 16:08 blurryrox

@HeaTTheatR After a few experimenting, i suspect that MDNavigationRail push the next box out of the screen, as it slides to the next screen, i can see it shows up for a little bit of sliding between the current and next screen.

And after adjusting the buttons position more to the left in kivymd/uix/buttons/buttons.py, it shows up perfectly.

blurryrox avatar Aug 25 '22 03:08 blurryrox

@blurryrox OK, I'll check it out.

HeaTTheatR avatar Aug 25 '22 03:08 HeaTTheatR