Skip to content

Commit 21045f4

Browse files
committed
Put the Slint logo on top of the gallery
Clicking on the logo goes to the slint website. The `SmallAppBar` doesn't really have ways to put custom stuff, so it's just manually placed on top.
1 parent d54ba3a commit 21045f4

File tree

8 files changed

+53
-6
lines changed

8 files changed

+53
-6
lines changed

REUSE.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ path = [
1212
"docs/public/favicon.ico",
1313
"docs/public/favicon-32x32.png",
1414
"docs/public/favicon-16x16.png",
15-
"docs/public/tablet-material.webp"
15+
"docs/public/tablet-material.webp",
16+
"examples/gallery/ui/slint-logo-**.svg"
1617
]
1718
precedence = "aggregate"
1819
SPDX-FileCopyrightText = "Copyright © SixtyFPS GmbH <[email protected]>"

examples/gallery/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ name = "material_gallery"
2020

2121
[dependencies]
2222
slint = { version = "1.12", features = ["backend-android-activity-06"] }
23+
webbrowser = "1"
2324

2425
[target.'cfg(target_family = "wasm")'.dependencies]
2526
wasm-bindgen = { version = "0.2" }

examples/gallery/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ slint::include_modules!();
1212
fn ui() -> MainWindow {
1313
let ui = MainWindow::new().unwrap();
1414
navigation_view(&ui);
15+
main_view(&ui);
1516
ui
1617
}
1718

@@ -76,3 +77,10 @@ fn color_item(name: &str, red: u8, green: u8, blue: u8, ui: &MainWindow) -> List
7677
..Default::default()
7778
}
7879
}
80+
81+
fn main_view(ui: &MainWindow) {
82+
let adapter = MainWindowAdapter::get(ui);
83+
adapter.on_open_url(|url|{
84+
let _ = webbrowser::open(&url);
85+
});
86+
}

examples/gallery/ui/main.slint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { MaterialWindow, MaterialWindowAdapter, ListItem } from "../../../materi
55
import { MainView } from "./views/main_view.slint";
66
import { MainWindowAdapter } from "./main_window_adapter.slint";
77
export { NavigationViewAdapter } from "./views/navigation_view.slint";
8-
export { MaterialWindowAdapter, ListItem }
8+
export { MaterialWindowAdapter, ListItem, MainWindowAdapter}
99
export { OutlinedIcons } from "./icons.slint";
1010
import "./fonts/Roboto-VariableFont.ttf";
1111

examples/gallery/ui/main_window_adapter.slint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ export global MainWindowAdapter {
99
in property <bool> container_background;
1010
out property <bool> break_layout: root.width < 852px;
1111
out property <brush> background: root.container_background ? MaterialPalette.surface_container : MaterialPalette.background;
12+
callback open-url(url: string);
1213
}
Lines changed: 11 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)