New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
library: Add Avatar entry #197
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start, thanks!
There are 3 “main” modes for avatar, see below for what I mean. Feel free to use as is.
The "Image…" button should let the user select a file. I'll let you figure this out but feel free to ask in the room if you struggle.
We should go with the simplest file chooser API. I'd suggest using https://docs.gtk.org/gtk4/class.FileDialog.html
It's brand new and will only be available in the next GNOME platform release but that doesn't mean we can't use it already.
You will need to set "runtime-version": "master",
in re.sonny.Workbench.Devel.json
to make use of it.
using Gtk 4.0;
using Adw 1;
Adw.StatusPage {
title: "Avatar";
description: "Display a round avatar for image or initials.";
Box {
orientation: vertical;
halign: center;
Adw.Avatar {
size: 96;
show-initials: true;
text: "John Doe";
margin-bottom: 6;
}
Label {
label: "Initials";
margin-bottom: 30;
}
Adw.Avatar {
size: 96;
margin-bottom:6;
}
Button {
label: "Image…";
margin-bottom: 30;
styles ["pill"]
}
Adw.Avatar {
size:96;
margin-bottom:6;
}
Label {
label: "Fallback";
margin-bottom: 30;
}
LinkButton {
label: "API Reference";
uri: "https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1.2/class.Avatar.html";
}
}
}
Thank you so much for the detailed review! I'll get back to you with the changes as quickly as possible. |
Co-authored-by: Sonny Piers <sonny@fastmail.net>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/Library/demos/Avatar/main.js
Outdated
const dialog = new Gtk.FileDialog(); | ||
|
||
const filter = new Gtk.FileFilter(); | ||
filter.name = "Image files"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new Gtk.FileFilter({
name: "something"
})
This does not seem to solve the issue. I'll still just leave it in, if it gets fixed in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done.
I have made minor changes before merging 5c14700
I have kept this demo fairly simple now. I wasn't sure if I should show
set_custom_image
orset_icon_name
.Relates to issue workbenchdev/demos#3