fix: headerbar and multi-window example improvements
This commit is contained in:
parent
8db82f295c
commit
ccb43d55c3
3 changed files with 10 additions and 17 deletions
|
|
@ -1,11 +1,11 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
app::Core,
|
app::{command::message::cosmic, Core},
|
||||||
iced::{self, event, window},
|
iced::{self, event, window},
|
||||||
iced_core::{id, Alignment, Length, Point},
|
iced_core::{id, Alignment, Length, Point},
|
||||||
iced_widget::{column, scrollable, text, text_input},
|
iced_widget::{column, scrollable, text, text_input},
|
||||||
widget::{button, container},
|
widget::{button, container, cosmic_container},
|
||||||
Command,
|
Command,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -132,14 +132,13 @@ impl cosmic::Application for MultiWindow {
|
||||||
|
|
||||||
let new_window_button = button(text("New Window")).on_press(Message::NewWindow);
|
let new_window_button = button(text("New Window")).on_press(Message::NewWindow);
|
||||||
|
|
||||||
let content = scrollable(
|
let content = column![input, new_window_button]
|
||||||
column![input, new_window_button]
|
|
||||||
.spacing(50)
|
.spacing(50)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.align_items(Alignment::Center),
|
.align_items(Alignment::Center);
|
||||||
);
|
|
||||||
|
|
||||||
container(container(content).width(200).center_x())
|
cosmic_container::container(container(content).width(200).center_x())
|
||||||
|
.style(cosmic::style::Container::Background)
|
||||||
.width(Length::Fill)
|
.width(Length::Fill)
|
||||||
.height(Length::Fill)
|
.height(Length::Fill)
|
||||||
.center_x()
|
.center_x()
|
||||||
|
|
@ -147,12 +146,6 @@ impl cosmic::Application for MultiWindow {
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn style(
|
|
||||||
&self,
|
|
||||||
) -> Option<<cosmic::Theme as cosmic::iced_style::application::StyleSheet>::Style> {
|
|
||||||
Some(Default::default())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn view(&self) -> cosmic::prelude::Element<Self::Message> {
|
fn view(&self) -> cosmic::prelude::Element<Self::Message> {
|
||||||
self.view_window(window::Id::MAIN)
|
self.view_window(window::Id::MAIN)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ impl Default for Settings {
|
||||||
#[cfg(feature = "wayland")]
|
#[cfg(feature = "wayland")]
|
||||||
size_limits: Limits::NONE.min_height(1.0).min_width(1.0),
|
size_limits: Limits::NONE.min_height(1.0).min_width(1.0),
|
||||||
theme: crate::theme::system_preference(),
|
theme: crate::theme::system_preference(),
|
||||||
transparent: false,
|
transparent: true,
|
||||||
exit_on_close: true,
|
exit_on_close: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -392,7 +392,7 @@ impl container::StyleSheet for Theme {
|
||||||
icon_color: Some(Color::from(palette.accent.base)),
|
icon_color: Some(Color::from(palette.accent.base)),
|
||||||
text_color: Some(Color::from(palette.background.on)),
|
text_color: Some(Color::from(palette.background.on)),
|
||||||
background: Some(iced::Background::Gradient(iced_core::Gradient::Linear(
|
background: Some(iced::Background::Gradient(iced_core::Gradient::Linear(
|
||||||
Linear::new(Radians(3.0 * PI / 2.0))
|
Linear::new(Radians(PI))
|
||||||
.add_stop(0.0, header_top.into())
|
.add_stop(0.0, header_top.into())
|
||||||
.add_stop(1.0, header_bottom.into()),
|
.add_stop(1.0, header_bottom.into()),
|
||||||
))),
|
))),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue