Adaptive layout for mobile - closes #66

This commit is contained in:
kramo
2023-07-05 11:03:08 +02:00
parent df461421c3
commit 6893551f1c
3 changed files with 164 additions and 141 deletions

View File

@@ -179,20 +179,40 @@ Adw.NavigationPage details_page {
name: "details_view";
[overlay]
Box details_view_box {
orientation: vertical;
Adw.ToolbarView details_view_toolbar_view {
[top]
Adw.HeaderBar {
styles [
"flat",
]
}
Adw.Bin {
Adw.BreakpointBin {
hexpand: true;
vexpand: true;
width-request: 229;
height-request: 54;
Box {
Adw.Breakpoint {
condition ("max-width: 564px")
setters {
details_view_box.orientation: vertical;
details_view_box.margin-top: 12;
details_view_box.margin-start: 12;
details_view_box.margin-end: 12;
details_view_details_box.margin-start: 0;
details_view_details_box.margin-end: 0;
details_view_title.margin-top: 30;
details_view_title.halign: center;
details_view_developer.halign: center;
details_view_date_box.halign: center;
details_view_toolbar.halign: center;
details_view_toolbar.orientation: vertical;
details_view_play_button.halign: center;
details_view_toolbar_buttons.margin-start: 0;
}
}
ScrolledWindow {
Box details_view_box {
halign: center;
valign: center;
margin-start: 24;
@@ -223,7 +243,7 @@ Adw.NavigationPage details_page {
}
}
Box {
Box details_view_details_box {
orientation: vertical;
margin-start: 48;
vexpand: true;
@@ -257,7 +277,7 @@ Adw.NavigationPage details_page {
]
}
Box {
Box details_view_date_box {
orientation: horizontal;
margin-top: 15;
hexpand: true;
@@ -267,6 +287,7 @@ Adw.NavigationPage details_page {
wrap: true;
wrap-mode: word_char;
natural-wrap-mode: word;
justify: center;
}
Label details_view_last_played {
@@ -274,10 +295,11 @@ Adw.NavigationPage details_page {
wrap: true;
wrap-mode: word_char;
natural-wrap-mode: word;
justify: center;
}
}
Box {
Box details_view_toolbar {
hexpand: true;
vexpand: true;
valign: center;
@@ -295,7 +317,7 @@ Adw.NavigationPage details_page {
]
}
Box {
Box details_view_toolbar_buttons {
halign: start;
valign: center;
margin-top: 24;
@@ -352,6 +374,7 @@ Adw.NavigationPage details_page {
}
}
}
}
Picture details_view_blurred_cover {
keep-aspect-ratio: false;

View File

@@ -22,7 +22,7 @@
<control>touch</control>
</supports>
<recommends>
<display_length compare="gt">545</display_length>
<display_length compare="gt">229</display_length>
</recommends>
<screenshots>
<screenshot type="default">

View File

@@ -43,7 +43,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
search_button = Gtk.Template.Child()
details_page = Gtk.Template.Child()
details_view_box = Gtk.Template.Child()
details_view_toolbar_view = Gtk.Template.Child()
details_view_cover = Gtk.Template.Child()
details_view_spinner = Gtk.Template.Child()
details_view_title = Gtk.Template.Child()
@@ -75,8 +75,8 @@ class CartridgesWindow(Adw.ApplicationWindow):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.details_view.set_measure_overlay(self.details_view_box, True)
self.details_view.set_clip_overlay(self.details_view_box, False)
self.details_view.set_measure_overlay(self.details_view_toolbar_view, True)
self.details_view.set_clip_overlay(self.details_view_toolbar_view, False)
self.library.set_filter_func(self.filter_func)
self.hidden_library.set_filter_func(self.filter_func)