Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positioning of MDTopAppBar elements #1660

Closed
AHiXilTOr opened this issue Mar 28, 2024 · 2 comments
Closed

Positioning of MDTopAppBar elements #1660

AHiXilTOr opened this issue Mar 28, 2024 · 2 comments
Labels
Type: Bug Bug report/Bug fix

Comments

@AHiXilTOr
Copy link

Description of the Bug

The _set_padding_title method in the MDTopAppBar class does not work correctly when on_text is triggered.

Code and Logs

from kivymd.app import MDApp
from kivy.lang import Builder

kv = """
#:import random random

MDScreen:
    md_bg_color: self.theme_cls.secondaryContainerColor

    MDTopAppBar:
        type: "small"
        size_hint_x: .8
        pos_hint: {"center_x": .5, "center_y": .55}

        MDTopAppBarLeadingButtonContainer:
            MDActionTopAppBarButton:
                icon: "arrow-left"

        MDTopAppBarTitle:
            id: title_label
            text: "AppBar small"

        MDTopAppBarTrailingButtonContainer:
            MDActionTopAppBarButton:
                icon: "attachment"

            MDActionTopAppBarButton:
                icon: "calendar"

            MDActionTopAppBarButton:
                icon: "dots-vertical"

    FloatLayout:

        Button:
            text: "Change"
            size_hint: None, None
            size: "150dp", "40dp"
            pos_hint: {"center_x": .5, "center_y": .45}
            on_release: app.root.ids.title_label.text = "".join(random.choices(''.join([chr(i) for i in range(97, 123)]), k=random.randint(5, 20)))
"""


class MyApp(MDApp):
    def build(self):
        return Builder.load_string(kv)


MyApp().run()

Versions

  • KivyMD: 2.0.1.dev0
@HeaTTheatR HeaTTheatR added the Type: Bug Bug report/Bug fix label Mar 28, 2024
@HeaTTheatR
Copy link
Member

Yes, it's a bug, thanks!

@AHiXilTOr
Copy link
Author

from kivymd.app import MDApp
from kivy.lang import Builder

kv = """
MDScreen:
    md_bg_color: self.theme_cls.secondaryContainerColor

    MDTopAppBar:
        type: "small"
        size_hint_x: .8
        pos_hint: {"center_x": .5, "center_y": .5}

        MDTopAppBarLeadingButtonContainer:

            MDActionTopAppBarButton:
                icon: "menu"

        MDTopAppBarTitle:
            text: "AppBar small"
            pos_hint: {"center_x": .5}

        MDTopAppBarTrailingButtonContainer:

            MDActionTopAppBarButton:
                icon: "account-circle-outline"
"""

class App(MDApp):
    def build(self):
        return Builder.load_string(kv)

App().run()

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug report/Bug fix
Projects
None yet
Development

No branches or pull requests

2 participants