Change notification layout
This commit is contained in:
1 parent
5a926b1419
commit
f113d2b3d7
3 files changed
+49
-34
No files matched your search
+24
-13
@@ -2,13 +2,14 @@ use crate::navigation::RootMessage;
|
||||
use crate::styling::{BUTTON_RADIUS, HALF_SPACING};
|
||||
use chrono::Utc;
|
||||
use iced::widget::container::Style;
|
||||
use iced::widget::{column, container, scrollable, text, Column};
|
||||
use iced::widget::{Column, column, container, row, scrollable, text};
|
||||
use iced::{Element, Task};
|
||||
use iced_core::alignment::Horizontal::Right;
|
||||
use iced_core::alignment::Vertical;
|
||||
use iced_core::Alignment::Center;
|
||||
use iced_core::Background::Color;
|
||||
use iced_core::Border;
|
||||
use iced_core::Length::Fill;
|
||||
use iced_core::alignment::Horizontal::Right;
|
||||
use iced_core::alignment::Vertical;
|
||||
|
||||
pub struct NotificationManager {
|
||||
list: Vec<(u32, NotificationRequest, u32)>,
|
||||
@@ -43,9 +44,12 @@ impl NotificationManager {
|
||||
column = column.push(Self::draw_notif(id, notif, time));
|
||||
}
|
||||
|
||||
container(scrollable(column)).width(Fill).height(Fill)
|
||||
container(scrollable(column))
|
||||
.width(Fill)
|
||||
.height(Fill)
|
||||
.align_x(Right)
|
||||
.align_y(Vertical::Top).padding(HALF_SPACING)
|
||||
.align_y(Vertical::Top)
|
||||
.padding(HALF_SPACING)
|
||||
.into()
|
||||
}
|
||||
|
||||
@@ -99,12 +103,15 @@ impl NotificationManager {
|
||||
}
|
||||
};
|
||||
|
||||
let container = container(column![
|
||||
iced::widget::button("✕")
|
||||
.on_press(NotificationMessage::Remove(*id))
|
||||
.style(iced::widget::button::text),
|
||||
content
|
||||
].align_x(Right).padding(HALF_SPACING));
|
||||
let container = container(
|
||||
row![
|
||||
content,
|
||||
iced::widget::button("✕")
|
||||
.on_press(NotificationMessage::Remove(*id))
|
||||
.style(iced::widget::button::text)
|
||||
].align_y(Center).width(300)
|
||||
.padding(HALF_SPACING),
|
||||
);
|
||||
container
|
||||
.style(move |theme| {
|
||||
let color = match color_id {
|
||||
@@ -116,7 +123,10 @@ impl NotificationManager {
|
||||
Style {
|
||||
text_color: None,
|
||||
background: Some(Color(color.scale_alpha(0.3))),
|
||||
border: Border::default().width(1).color(color).rounded(BUTTON_RADIUS),
|
||||
border: Border::default()
|
||||
.width(1)
|
||||
.color(color)
|
||||
.rounded(BUTTON_RADIUS),
|
||||
shadow: Default::default(),
|
||||
snap: false,
|
||||
}
|
||||
@@ -145,6 +155,7 @@ impl NotificationManager {
|
||||
text!("У приложение недостаточно прав")
|
||||
}
|
||||
}
|
||||
.width(Fill)
|
||||
.into()
|
||||
}
|
||||
}
|
||||
@@ -163,5 +174,5 @@ pub enum NotificationData {
|
||||
ImportError,
|
||||
IncorrectAnkiFile,
|
||||
OpenFileError,
|
||||
VoiceVoxUnavailable
|
||||
VoiceVoxUnavailable,
|
||||
}
|
||||
Reference in new issue
Block a user