KivyMD icon indicating copy to clipboard operation
KivyMD copied to clipboard

Positioning of MDTopAppBar elements

Open AHiXilTOr opened this issue 4 months ago • 1 comments

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

AHiXilTOr avatar Mar 28 '24 14:03 AHiXilTOr