fix: multi-window example headerbar
the headerbar is transparent, but a wrapping container applies the right color
This commit is contained in:
parent
03a66751ea
commit
b0b9bf16f4
1 changed files with 17 additions and 6 deletions
|
|
@ -5,7 +5,7 @@ use cosmic::iced::core::{id, Alignment, Length, Point};
|
||||||
use cosmic::iced::widget::{column, container, scrollable, text};
|
use cosmic::iced::widget::{column, container, scrollable, text};
|
||||||
use cosmic::iced::{self, event, window, Subscription};
|
use cosmic::iced::{self, event, window, Subscription};
|
||||||
use cosmic::prelude::*;
|
use cosmic::prelude::*;
|
||||||
use cosmic::widget::{button, header_bar};
|
use cosmic::widget::{button, header_bar, selectable_text};
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Message {
|
pub enum Message {
|
||||||
|
|
@ -132,10 +132,14 @@ impl cosmic::Application for MultiWindow {
|
||||||
let new_window_button = button::custom(text("New Window")).on_press(Message::NewWindow);
|
let new_window_button = button::custom(text("New Window")).on_press(Message::NewWindow);
|
||||||
|
|
||||||
let content = scrollable(
|
let content = scrollable(
|
||||||
column![input, new_window_button]
|
column![
|
||||||
.spacing(50)
|
input,
|
||||||
.width(Length::Fill)
|
new_window_button,
|
||||||
.align_x(Alignment::Center),
|
selectable_text::title1("I'm selectable...")
|
||||||
|
]
|
||||||
|
.spacing(50)
|
||||||
|
.width(Length::Fill)
|
||||||
|
.align_x(Alignment::Center),
|
||||||
);
|
);
|
||||||
|
|
||||||
let window_content = container(container(content).center_x(Length::Fixed(200.)))
|
let window_content = container(container(content).center_x(Length::Fixed(200.)))
|
||||||
|
|
@ -146,7 +150,14 @@ impl cosmic::Application for MultiWindow {
|
||||||
if id == self.core.main_window_id().unwrap() {
|
if id == self.core.main_window_id().unwrap() {
|
||||||
window_content.into()
|
window_content.into()
|
||||||
} else {
|
} else {
|
||||||
column![header_bar().focused(focused), window_content].into()
|
container(column![
|
||||||
|
header_bar()
|
||||||
|
.on_close(Message::CloseWindow(id))
|
||||||
|
.focused(focused),
|
||||||
|
window_content
|
||||||
|
])
|
||||||
|
.class(cosmic::theme::Container::WindowBackground)
|
||||||
|
.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue