Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions src/Library/demos/Breakpoints/main.blp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using Gtk 4.0;
using Adw 1;

Gtk.Window {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have a title/subtitle like others demo?

We can also add a text that says "Resize the window to see the breakpoint effect"

width-request: 360;
height-request: 200;
default-width: 640;
default-height: 480;
title: bind page.title;

Adw.StatusPage page {
title: _("Breakpoints");
description: _("Resize the window to see the breakpoint effect");
child: Box {
orientation: vertical;
spacing: 12;
valign: center;

Image image {
icon-size: large;
icon-name: "smile-symbolic";
}

Adw.BreakpointBin breakpoint_bin {
width-request: 200;
height-request: 50;

Adw.Breakpoint breakpoint {
condition ("max-width: 500sp")
setters {
breakpoint_bin.child: label_narrow;
image.icon-size: normal;
}
}

child: label_wide;
}

LinkButton {
margin-top: 24;
label: "Breakpoint";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.Breakpoint.html";
}

LinkButton {
label: "Breakpoint Bin";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/class.BreakpointBin.html";
}
};
}
}

Label label_narrow {
label: _("Narrow");
styles ["title-4"]
}

Label label_wide {
label: _("Wide");
styles ["title-1"]
}
11 changes: 11 additions & 0 deletions src/Library/demos/Breakpoints/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Gtk from "gi://Gtk";

const breakpoint = workbench.builder.get_object("breakpoint");

breakpoint.connect("apply", () => {
console.log("Breakpoint Applied");
});

breakpoint.connect("unapply", () => {
console.log("Breakpoint Unapplied");
});
6 changes: 6 additions & 0 deletions src/Library/demos/Breakpoints/main.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"category": "layout",
"description": "Create adaptive UI",
"panels": ["ui", "preview"],
"autorun": true
}