From 33898e2519e3e91923361b0cf12fb2f3e78c8d6e Mon Sep 17 00:00:00 2001 From: Nokse22 <44558032+Nokse22@users.noreply.github.com> Date: Wed, 9 Oct 2024 00:28:07 +0200 Subject: [PATCH 1/3] Added Bottom Sheet demo --- src/Bottom Sheet/main.blp | 72 ++++++++++++++++++++++++++++++++++++++ src/Bottom Sheet/main.json | 6 ++++ 2 files changed, 78 insertions(+) create mode 100644 src/Bottom Sheet/main.blp create mode 100644 src/Bottom Sheet/main.json diff --git a/src/Bottom Sheet/main.blp b/src/Bottom Sheet/main.blp new file mode 100644 index 00000000..8152b0c0 --- /dev/null +++ b/src/Bottom Sheet/main.blp @@ -0,0 +1,72 @@ +using Gtk 4.0; +using Adw 1; + +Adw.Bin { + Adw.BottomSheet bottom_sheet { + bottom-bar: Label { + label: "Bottom Bar"; + margin-bottom: 12; + margin-end: 12; + margin-start: 12; + margin-top: 12; + }; + + content: Adw.StatusPage { + child: Box { + orientation: vertical; + spacing: 12; + halign: center; + LinkButton { + label: _("API Reference"); + uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.BottomSheet.html"; + } + Adw.Clamp { + child: Adw.PreferencesGroup { + Adw.SwitchRow { + active: bind bottom_sheet.full-width bidirectional; + title: "Full Width"; + } + + Adw.SwitchRow { + active: bind bottom_sheet.can-open bidirectional; + title: "Can Open"; + } + + Adw.SwitchRow { + active: bind bottom_sheet.open bidirectional; + title: "Open"; + } + }; + } + }; + + description: "Display content with a bottom sheet"; + title: "Bottom Sheet"; + }; + + sheet: Adw.StatusPage { + width-request: 360; + + child: Adw.Clamp { + child: Adw.PreferencesGroup { + Adw.SwitchRow { + active: bind bottom_sheet.can-close bidirectional; + title: "Can Close"; + } + + Adw.SwitchRow { + active: bind bottom_sheet.show-drag-handle bidirectional; + title: "Show Drag Handle"; + } + + Adw.SwitchRow { + active: bind bottom_sheet.modal bidirectional; + title: "Modal"; + } + }; + }; + + title: "Sheet"; + }; + } +} diff --git a/src/Bottom Sheet/main.json b/src/Bottom Sheet/main.json new file mode 100644 index 00000000..682ae7fb --- /dev/null +++ b/src/Bottom Sheet/main.json @@ -0,0 +1,6 @@ +{ + "category": "layout", + "description": "Display content with a bottom sheet", + "panels": ["ui", "preview"], + "autorun": true +} From 50967d4beeb82e03ab16330dbdcac03548b12d48 Mon Sep 17 00:00:00 2001 From: Nokse22 <44558032+Nokse22@users.noreply.github.com> Date: Wed, 9 Oct 2024 00:39:25 +0200 Subject: [PATCH 2/3] fixed formatting --- src/Bottom Sheet/main.blp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bottom Sheet/main.blp b/src/Bottom Sheet/main.blp index 8152b0c0..e4ebf1e1 100644 --- a/src/Bottom Sheet/main.blp +++ b/src/Bottom Sheet/main.blp @@ -16,17 +16,19 @@ Adw.Bin { orientation: vertical; spacing: 12; halign: center; + LinkButton { label: _("API Reference"); uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.BottomSheet.html"; } + Adw.Clamp { child: Adw.PreferencesGroup { Adw.SwitchRow { active: bind bottom_sheet.full-width bidirectional; title: "Full Width"; } - + Adw.SwitchRow { active: bind bottom_sheet.can-open bidirectional; title: "Can Open"; From c497facd29f1b1eb8fefc78e5e5cc67daa1cd2d3 Mon Sep 17 00:00:00 2001 From: Nokse22 <44558032+Nokse22@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:38:52 +0200 Subject: [PATCH 3/3] marked strings as translatable, reordered widgets and properties --- src/Bottom Sheet/main.blp | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Bottom Sheet/main.blp b/src/Bottom Sheet/main.blp index e4ebf1e1..82442346 100644 --- a/src/Bottom Sheet/main.blp +++ b/src/Bottom Sheet/main.blp @@ -4,7 +4,7 @@ using Adw 1; Adw.Bin { Adw.BottomSheet bottom_sheet { bottom-bar: Label { - label: "Bottom Bar"; + label: _("Bottom Bar"); margin-bottom: 12; margin-end: 12; margin-start: 12; @@ -12,63 +12,62 @@ Adw.Bin { }; content: Adw.StatusPage { + description: _("Display content with a bottom sheet"); + title: _("Bottom Sheet"); + child: Box { orientation: vertical; spacing: 12; halign: center; - LinkButton { - label: _("API Reference"); - uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.BottomSheet.html"; - } - Adw.Clamp { child: Adw.PreferencesGroup { Adw.SwitchRow { active: bind bottom_sheet.full-width bidirectional; - title: "Full Width"; + title: _("Full Width"); } Adw.SwitchRow { active: bind bottom_sheet.can-open bidirectional; - title: "Can Open"; + title: _("Can Open"); } Adw.SwitchRow { active: bind bottom_sheet.open bidirectional; - title: "Open"; + title: _("Open"); } }; } - }; - description: "Display content with a bottom sheet"; - title: "Bottom Sheet"; + LinkButton { + label: _("API Reference"); + uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.BottomSheet.html"; + } + }; }; sheet: Adw.StatusPage { width-request: 360; + title: _("Sheet"); child: Adw.Clamp { child: Adw.PreferencesGroup { Adw.SwitchRow { active: bind bottom_sheet.can-close bidirectional; - title: "Can Close"; + title: _("Can Close"); } Adw.SwitchRow { active: bind bottom_sheet.show-drag-handle bidirectional; - title: "Show Drag Handle"; + title: _("Show Drag Handle"); } Adw.SwitchRow { active: bind bottom_sheet.modal bidirectional; - title: "Modal"; + title: _("Modal"); } }; }; - - title: "Sheet"; }; } }