Fix button scaling issue on smaller devices in CRUD template

This commit is contained in:
Sn3llius
2025-02-25 18:19:40 +01:00
parent 4c0b9fe50a
commit b2bccfb6a8

View File

@@ -364,7 +364,12 @@ class CrudPage(rio.Component):
right_child=rio.Button(
rio.Icon("material/delete", margin=0.5),
color=self.session.theme.danger_color,
min_width=8,
# Center button vertically so it doesn't blow up on
# smaller screens.
align_y=0.5,
# Adjust button size based on window width. Smaller
# buttons for smaller screens.
min_width=8 if self.session.window_width > 60 else 4,
# Note the use of functools.partial to pass the
# index to the event handler.
on_press=functools.partial(