kivymd / KivyMD

KivyMD is a collection of Material Design compliant widgets for use with Kivy, a framework for cross-platform, touch-enabled graphical applications. https://youtube.com/c/KivyMD https://twitter.com/KivyMD https://habr.com/ru/users/kivymd https://stackoverflow.com/tags/kivymd
https://kivymd.readthedocs.io
MIT License
2.26k stars 674 forks source link

MDTextFieldLeadingIcon & MDTextFieldTrailingIcon not visible in MDDialog #1667

Closed NGFWeber closed 7 months ago

NGFWeber commented 7 months ago

Description of the Bug

MDTextFieldLeadingIcon & MDTextFieldTrailingIcon are not visible in Dialog Content.

Code and Logs

from kivymd.app import MDApp
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout

from kivymd.uix.dialog import (
    MDDialog,
    MDDialogHeadlineText,
    MDDialogContentContainer,
)

KV_STRING = """
<DialogContent>
   orientation: "vertical"
   spacing: dp(12)
   size_hint_y: None
   height: dp(300)
   pos_hint: { "top": 1 }

   MDTextField:
      MDTextFieldLeadingIcon:
         icon: "cog"

      MDTextFieldHintText:
         text: "icons NOT OK"

      MDTextFieldTrailingIcon:
         icon: "close"

MDScreen:
   md_bg_color: self.theme_cls.backgroundColor
   MDButton:
      pos_hint: {"center_x": .5, "center_y": .5}
      on_release: app.open_custom_dialog()

      MDButtonText:
         text: "Open Dialog"

   MDTextField:
      MDTextFieldLeadingIcon:
         icon: "cog"

      MDTextFieldHintText:
         text: "icons OK"

      MDTextFieldTrailingIcon:
         icon: "close"

"""

class DialogContent( BoxLayout ):
   def __init__(self, **kwargs):
      super().__init__(**kwargs)

class MainApp( MDApp ):

   dialog = None

   def build(self):
      return Builder.load_string( KV_STRING )

   def open_custom_dialog(self):
      print("open_custom_dialog")
      if not self.dialog:
         self.dialog = MDDialog(
            MDDialogHeadlineText( text="TITLE" ),
            MDDialogContentContainer( DialogContent() )
         )
      self.dialog.open()

MainApp().run()

Screenshots

Screenshot 2024-04-04 152029

Versions

NGFWeber commented 7 months ago

may be related to https://github.com/kivymd/KivyMD/issues/1628

HeaTTheatR commented 7 months ago

https://github.com/kivymd/KivyMD/issues/1628