Fixed dialog sizing on mobile

This commit is contained in:
Mark Qvist 2024-09-08 13:17:04 +02:00
parent c6f82a917d
commit 66065bc3ef

View File

@ -413,7 +413,7 @@ class MDDialog(BaseDialog):
and defaults to `[]`. and defaults to `[]`.
""" """
width_offset = NumericProperty(dp(48)) width_offset = NumericProperty(dp(32))
""" """
Dialog offset from device width. Dialog offset from device width.
@ -601,7 +601,7 @@ class MDDialog(BaseDialog):
self.width = min(dp(560), Window.width - self.width_offset) self.width = min(dp(560), Window.width - self.width_offset)
elif self.size_hint == [1, 1] and DEVICE_TYPE == "mobile": elif self.size_hint == [1, 1] and DEVICE_TYPE == "mobile":
self.size_hint = (None, None) self.size_hint = (None, None)
self.width = min(dp(280), Window.width - self.width_offset) self.width = min(dp(560), Window.width - self.width_offset)
if not self.title: if not self.title:
self._spacer_top = 0 self._spacer_top = 0
@ -634,7 +634,7 @@ class MDDialog(BaseDialog):
self.width = max( self.width = max(
self.height + self.width_offset, self.height + self.width_offset,
min( min(
dp(560) if DEVICE_TYPE != "mobile" else dp(280), dp(560) if DEVICE_TYPE != "mobile" else dp(560),
Window.width - self.width_offset, Window.width - self.width_offset,
), ),
) )