Visual changes
This commit is contained in:
+18
-5
@@ -9,8 +9,10 @@ use crate::styling::*;
|
||||
use crate::sync::SyncState;
|
||||
use crate::writing::WritingState;
|
||||
use crate::{AppState, QuizState, RootMessage};
|
||||
use iced::widget::button::{Status, Style};
|
||||
use iced::widget::*;
|
||||
use iced::{alignment, Element, Task};
|
||||
use iced::{Element, Task, alignment};
|
||||
use iced_core::{Background, Color};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
pub struct SelectorState {
|
||||
@@ -80,6 +82,17 @@ impl SelectorState {
|
||||
Task::none()
|
||||
}
|
||||
|
||||
fn nav_style(theme: &Theme, status: Status) -> Style {
|
||||
let mut basic = button::text(theme, status);
|
||||
basic.background = if status == Status::Hovered {
|
||||
Some(Background::Color(Color::WHITE.scale_alpha(0.1)))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
basic.border.radius = BUTTON_RADIUS.into();
|
||||
basic
|
||||
}
|
||||
|
||||
pub fn view(&self) -> Element<'_, SelectorMessage> {
|
||||
container(
|
||||
iced::widget::column![
|
||||
@@ -89,16 +102,16 @@ impl SelectorState {
|
||||
.style(jl_button),
|
||||
button("Словарь")
|
||||
.on_press(SelectorMessage::ToDictionary)
|
||||
.style(button::text),
|
||||
.style(Self::nav_style),
|
||||
button("Рандомайзер")
|
||||
.on_press(SelectorMessage::ToRandomize)
|
||||
.style(button::text),
|
||||
.style(Self::nav_style),
|
||||
button("Повторение")
|
||||
.on_press(SelectorMessage::ToRepetitions)
|
||||
.style(button::text),
|
||||
.style(Self::nav_style),
|
||||
button("Синхронизация")
|
||||
.on_press(SelectorMessage::ToSync)
|
||||
.style(button::text)
|
||||
.style(Self::nav_style)
|
||||
]
|
||||
.spacing(DEFAULT_SPACING),
|
||||
self.rows_selector(),
|
||||
|
||||
Reference in New Issue
Block a user