Before button global styling

This commit is contained in:
2026-08-01 13:04:18 +03:00
parent ce94b01543
commit d9bd1b1b86
16 changed files with 304 additions and 218 deletions
+14 -9
View File
@@ -2,16 +2,18 @@ use crate::data_provider::card_sets::{delete_set, update_card_set};
use crate::data_provider::card_stats::load_stats_of_set;
use crate::lang::{SetOrderMode, WordData};
use crate::repetition::RepetitionState;
use crate::Page::{History, PreviousPage, Repetition};
use crate::{AppState, NavigatedPage, Page, RootMessage, DEFAULT_SPACING};
use iced::widget::button::danger;
use crate::{AppState, RootMessage};
use iced::widget::button::{danger, Status};
pub use iced::widget::button::{Catalog, Style};
use iced::widget::container::bordered_box;
use iced::widget::{button, column, container, radio, row, scrollable, space, text, text_input, Column};
use iced::{Border, Center, Element, Fill, Left, Length, Shadow, Task, Theme};
use iced::{color, Background, Border, Center, Color, Element, Fill, Left, Length, Shadow, Task, Theme};
use rhai::{Engine, Scope};
use std::sync::{Arc, Mutex};
use crate::history::HistoryState;
use crate::navigation::{NavigatedPage, Page};
use crate::navigation::Page::{History, PreviousPage, Repetition};
use crate::styling::*;
#[derive(Clone)]
pub struct RepetitionsState {
@@ -134,7 +136,6 @@ impl RepetitionsState {
self.launch_button()
]
.align_y(Center)
.padding(10)
.spacing(DEFAULT_SPACING)
.width(Fill)
.height(Fill)
@@ -148,7 +149,7 @@ impl RepetitionsState {
}
fn launch_button(&self) -> Element<'_, RepetitionsMessage> {
if let Some(_) = self.selected_set {
if let Some(set) = self.selected_set && self.state.lock().unwrap().card_sets[set].id != 0 {
return button(text!("").height(Fill).center())
.height(200)
.on_press(RepetitionsMessage::GoToRepetition)
@@ -235,14 +236,18 @@ impl RepetitionsState {
column = column.push(
button(text!("{}", set.name.clone()))
.on_press_with(move || RepetitionsMessage::SelectSet(i.clone()))
.style(move |_x: &Theme, _status| Style {
background: None,
.style(move |_x: &Theme, status : Status| Style {
background: if status == Status::Hovered {Some(Background::Color(Color::WHITE.scale_alpha(0.1)))} else { None },
text_color: if self.correct_filters[i.clone()] {
_x.palette().primary
} else {
_x.palette().warning
},
border: Border::default(),
border: Border{
color: Default::default(),
width: 0.0,
radius: 8.0.into(),
},
shadow: Shadow::default(),
snap: false,
}),