Migrate to tiny macros of button
This commit is contained in:
1 parent
444352c007
commit
1ad991667b
12 files changed
+52
-45
No files matched your search
@@ -11,7 +11,7 @@ use crate::pages::dictionary::DictionaryMessage::*;
|
|||||||
use crate::pages::dictionary_quiz::DictionaryQuizState;
|
use crate::pages::dictionary_quiz::DictionaryQuizState;
|
||||||
use crate::pages::import::ImportState;
|
use crate::pages::import::ImportState;
|
||||||
use crate::pages::word::WordState;
|
use crate::pages::word::WordState;
|
||||||
use crate::push_error;
|
use crate::{jl_button, push_error};
|
||||||
use crate::push_error_task;
|
use crate::push_error_task;
|
||||||
use crate::styling::*;
|
use crate::styling::*;
|
||||||
use chrono::{DateTime, TimeDelta, Utc};
|
use chrono::{DateTime, TimeDelta, Utc};
|
||||||
@@ -81,7 +81,7 @@ impl NavigatedPage<DictionaryMessage> for DictionaryState {
|
|||||||
let mut words = vec![];
|
let mut words = vec![];
|
||||||
let dict = &self.state.dictionary.read();
|
let dict = &self.state.dictionary.read();
|
||||||
|
|
||||||
let mut query = dict.query(Arc::new(|_| true));
|
let query = dict.query(Arc::new(|_| true));
|
||||||
let handles = query.handles();
|
let handles = query.handles();
|
||||||
words = handles.filter(|h| self.included.contains(h)).collect();
|
words = handles.filter(|h| self.included.contains(h)).collect();
|
||||||
|
|
||||||
@@ -257,7 +257,7 @@ impl NavigatedPage<DictionaryMessage> for DictionaryState {
|
|||||||
|
|
||||||
let mut dictionary = self.state.dictionary.write();
|
let mut dictionary = self.state.dictionary.write();
|
||||||
|
|
||||||
let reload_query = handle.real() == false;
|
let reload_query = !handle.real();
|
||||||
let _ = dictionary.save(&mut handle);
|
let _ = dictionary.save(&mut handle);
|
||||||
if reload_query {
|
if reload_query {
|
||||||
self.displayed_words_query.load(&dictionary);
|
self.displayed_words_query.load(&dictionary);
|
||||||
@@ -373,7 +373,7 @@ impl DictionaryState {
|
|||||||
key: word.key.clone().into(),
|
key: word.key.clone().into(),
|
||||||
value: word.value.clone().into(),
|
value: word.value.clone().into(),
|
||||||
tags: word.tags.clone().into(),
|
tags: word.tags.clone().into(),
|
||||||
handle: word_handle.clone(),
|
handle: *word_handle,
|
||||||
};
|
};
|
||||||
|
|
||||||
let lazy_line = lazy(word_line_data, Self::word_line);
|
let lazy_line = lazy(word_line_data, Self::word_line);
|
||||||
@@ -387,7 +387,7 @@ impl DictionaryState {
|
|||||||
|
|
||||||
fn word_line<'a>(data: &WordLineState) -> Row<'a, DictionaryMessage> {
|
fn word_line<'a>(data: &WordLineState) -> Row<'a, DictionaryMessage> {
|
||||||
let mut line = Row::new().width(Fill).align_y(Center);
|
let mut line = Row::new().width(Fill).align_y(Center);
|
||||||
let handle = data.handle.clone();
|
let handle = data.handle;
|
||||||
line = line.push(
|
line = line.push(
|
||||||
checkbox(data.is_included)
|
checkbox(data.is_included)
|
||||||
.label("")
|
.label("")
|
||||||
@@ -435,7 +435,7 @@ impl DictionaryState {
|
|||||||
return button("-")
|
return button("-")
|
||||||
.on_press(WordAction(data.handle))
|
.on_press(WordAction(data.handle))
|
||||||
.style(
|
.style(
|
||||||
|_x: &iced::Theme, _status: iced::widget::button::Status| Style {
|
|_x: &Theme, _status: button::Status| Style {
|
||||||
background: None,
|
background: None,
|
||||||
text_color: Color::BLACK,
|
text_color: Color::BLACK,
|
||||||
border: Border::default(),
|
border: Border::default(),
|
||||||
@@ -590,12 +590,12 @@ impl DictionaryState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let groups = self.state.word_groups.read();
|
let groups = self.state.word_groups.read();
|
||||||
let group = groups.get_static(self.selected_group.clone()).unwrap();
|
let group = groups.get_static(self.selected_group).unwrap();
|
||||||
|
|
||||||
iced::widget::column![
|
iced::widget::column![
|
||||||
scrollable(row).width(Fill).horizontal(),
|
scrollable(row).width(Fill).horizontal(),
|
||||||
row![
|
row![
|
||||||
button("⇳").on_press(ChangeDirection).style(jl_button),
|
jl_button!("⇳").on_press(ChangeDirection),
|
||||||
text_input("Название группы слов", &group.name)
|
text_input("Название группы слов", &group.name)
|
||||||
.on_input(EditGroup)
|
.on_input(EditGroup)
|
||||||
.width(250)
|
.width(250)
|
||||||
@@ -617,7 +617,7 @@ impl DictionaryState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn add_word_button(&self) -> iced::Element<'_, DictionaryMessage> {
|
fn add_word_button(&self) -> iced::Element<'_, DictionaryMessage> {
|
||||||
let button = button("Добавить слово").style(jl_button);
|
let button = jl_button!("Добавить слово");
|
||||||
|
|
||||||
if self.selected_group.real() {
|
if self.selected_group.real() {
|
||||||
return button.on_press(NewWord).into();
|
return button.on_press(NewWord).into();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use iced::{Border, Element, Fill, Task, Theme, alignment};
|
|||||||
use rand::prelude::SliceRandom;
|
use rand::prelude::SliceRandom;
|
||||||
use crate::app::AppState;
|
use crate::app::AppState;
|
||||||
use crate::data::repositories::Repository;
|
use crate::data::repositories::Repository;
|
||||||
|
use crate::jl_button;
|
||||||
|
|
||||||
pub struct DictionaryQuizState {
|
pub struct DictionaryQuizState {
|
||||||
state: AppState,
|
state: AppState,
|
||||||
@@ -91,7 +92,7 @@ impl NavigatedPage<DictionaryQuizMessage> for DictionaryQuizState {
|
|||||||
]
|
]
|
||||||
.spacing(DEFAULT_SPACING),
|
.spacing(DEFAULT_SPACING),
|
||||||
row![
|
row![
|
||||||
button("Закончить").style(jl_button).on_press(Back),
|
jl_button!("Закончить").on_press(Back),
|
||||||
self.appeal_button()
|
self.appeal_button()
|
||||||
]
|
]
|
||||||
.spacing(DEFAULT_SPACING),
|
.spacing(DEFAULT_SPACING),
|
||||||
@@ -218,7 +219,7 @@ impl DictionaryQuizState {
|
|||||||
|
|
||||||
fn appeal_button(&self) -> Element<'_, DictionaryQuizMessage> {
|
fn appeal_button(&self) -> Element<'_, DictionaryQuizMessage> {
|
||||||
if self.is_help && !self.no_typing {
|
if self.is_help && !self.no_typing {
|
||||||
return button("Апелляция").style(jl_button).on_press(Appeal).into();
|
return jl_button!("Апелляция").on_press(Appeal).into();
|
||||||
}
|
}
|
||||||
space().into()
|
space().into()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -9,6 +9,7 @@ use crate::notification::NotificationData::OpenFileError;
|
|||||||
use crate::notification::{MaybeError, NotificationData};
|
use crate::notification::{MaybeError, NotificationData};
|
||||||
use crate::pages::import::ImportMessage::*;
|
use crate::pages::import::ImportMessage::*;
|
||||||
use crate::push_error;
|
use crate::push_error;
|
||||||
|
use crate::jl_button;
|
||||||
use crate::styling::*;
|
use crate::styling::*;
|
||||||
use iced::widget::button::danger;
|
use iced::widget::button::danger;
|
||||||
use iced::widget::container::success;
|
use iced::widget::container::success;
|
||||||
@@ -155,7 +156,7 @@ impl NavigatedPage<ImportMessage> for ImportState {
|
|||||||
scrollable(
|
scrollable(
|
||||||
column![
|
column![
|
||||||
row![
|
row![
|
||||||
button("Выбрать файл").style(jl_button).on_press(SelectFile),
|
jl_button!("Выбрать файл").on_press(SelectFile),
|
||||||
text!("{}", {
|
text!("{}", {
|
||||||
if let Some(path) = &self.path {
|
if let Some(path) = &self.path {
|
||||||
path.to_string_lossy().to_string()
|
path.to_string_lossy().to_string()
|
||||||
|
|||||||
+2
-1
@@ -7,6 +7,7 @@ use crate::styling::*;
|
|||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{Element, Fill, Task, alignment};
|
use iced::{Element, Fill, Task, alignment};
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
|
use crate::jl_button;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct QuizState {
|
pub struct QuizState {
|
||||||
@@ -82,7 +83,7 @@ impl NavigatedPage<QuizMessage> for QuizState {
|
|||||||
.width(150)
|
.width(150)
|
||||||
.on_input(ContentChanged),
|
.on_input(ContentChanged),
|
||||||
score_display(&self.score),
|
score_display(&self.score),
|
||||||
button("Закончить").style(jl_button).on_press(Back),
|
jl_button!("Закончить").on_press(Back),
|
||||||
]
|
]
|
||||||
.spacing(DEFAULT_SPACING)
|
.spacing(DEFAULT_SPACING)
|
||||||
.align_x(alignment::Horizontal::Center),
|
.align_x(alignment::Horizontal::Center),
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
use crate::navigation::RootMessage;
|
use crate::navigation::RootMessage;
|
||||||
use crate::navigation::{NavigatedPage, Page};
|
use crate::navigation::{NavigatedPage, Page};
|
||||||
use crate::pages::randomizer::RandomizerMessage::{Back, Edit, Start};
|
use crate::pages::randomizer::RandomizerMessage::{Back, Edit, Start};
|
||||||
use crate::styling::{HALF_SPACING, back_overlay, jl_button};
|
use crate::styling::{HALF_SPACING, back_overlay};
|
||||||
|
use crate::jl_button;
|
||||||
use iced::Task;
|
use iced::Task;
|
||||||
use iced::widget::{button, text_editor};
|
use iced::widget::text_editor;
|
||||||
use rand::prelude::SliceRandom;
|
use rand::prelude::SliceRandom;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@@ -56,7 +57,7 @@ impl NavigatedPage<RandomizerMessage> for RandomizerState {
|
|||||||
.width(400)
|
.width(400)
|
||||||
.height(400)
|
.height(400)
|
||||||
.placeholder("Каждый элемент с новой строки"),
|
.placeholder("Каждый элемент с новой строки"),
|
||||||
button("Перемешать").style(jl_button).on_press(Start),
|
jl_button!("Перемешать").on_press(Start),
|
||||||
]
|
]
|
||||||
.spacing(HALF_SPACING)
|
.spacing(HALF_SPACING)
|
||||||
.into(),
|
.into(),
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use crate::navigation::Page::PreviousPage;
|
|||||||
use crate::navigation::{KeyPressedPage, NavigatedPage, Page, RootMessage};
|
use crate::navigation::{KeyPressedPage, NavigatedPage, Page, RootMessage};
|
||||||
use crate::notification::{MaybeError, NotificationData};
|
use crate::notification::{MaybeError, NotificationData};
|
||||||
use crate::pages::repetitions::DeckRunData;
|
use crate::pages::repetitions::DeckRunData;
|
||||||
|
use crate::jl_button;
|
||||||
use crate::styling::*;
|
use crate::styling::*;
|
||||||
use crate::{push_error, push_error_task};
|
use crate::{push_error, push_error_task};
|
||||||
use iced::alignment::Horizontal::Center;
|
use iced::alignment::Horizontal::Center;
|
||||||
@@ -255,8 +256,7 @@ impl RepetitionState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn draw_voice(&self) -> Element<'_, RepetitionMessage> {
|
fn draw_voice(&self) -> Element<'_, RepetitionMessage> {
|
||||||
button("Воспроизвести")
|
jl_button!("Воспроизвести")
|
||||||
.style(jl_button)
|
|
||||||
.on_press(RepetitionMessage::Play)
|
.on_press(RepetitionMessage::Play)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ use crate::navigation::Page::PreviousPage;
|
|||||||
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
||||||
use crate::notification::MaybeError;
|
use crate::notification::MaybeError;
|
||||||
use crate::pages::repetition_settings::RepetitionSettingsMessage::*;
|
use crate::pages::repetition_settings::RepetitionSettingsMessage::*;
|
||||||
|
use crate::jl_button;
|
||||||
use crate::styling::*;
|
use crate::styling::*;
|
||||||
use crate::{push_error, push_error_task};
|
use crate::{push_error, push_error_task};
|
||||||
use iced::widget::button::danger;
|
use iced::widget::button::danger;
|
||||||
@@ -163,8 +164,7 @@ impl NavigatedPage<RepetitionSettingsMessage> for RepetitionSettingsState {
|
|||||||
primary
|
primary
|
||||||
})
|
})
|
||||||
.on_input(SetFilter),
|
.on_input(SetFilter),
|
||||||
button("Проверить фильтр")
|
jl_button!("Проверить фильтр")
|
||||||
.style(jl_button)
|
|
||||||
.on_press(TryFilter),
|
.on_press(TryFilter),
|
||||||
self.count_view(),
|
self.count_view(),
|
||||||
]
|
]
|
||||||
@@ -180,7 +180,7 @@ impl NavigatedPage<RepetitionSettingsMessage> for RepetitionSettingsState {
|
|||||||
)
|
)
|
||||||
.height(Fill),
|
.height(Fill),
|
||||||
row![
|
row![
|
||||||
button("Сохранить").style(jl_button).on_press(Save),
|
jl_button!("Сохранить").on_press(Save),
|
||||||
horizontal(),
|
horizontal(),
|
||||||
button(if self.real_delete_states {
|
button(if self.real_delete_states {
|
||||||
"Вы уверены?"
|
"Вы уверены?"
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use crate::pages::repetition_settings::RepetitionSettingsState;
|
|||||||
use crate::pages::repetitions::RepetitionsMessage::*;
|
use crate::pages::repetitions::RepetitionsMessage::*;
|
||||||
use crate::push_error;
|
use crate::push_error;
|
||||||
use crate::push_error_task;
|
use crate::push_error_task;
|
||||||
|
use crate::jl_button;
|
||||||
use crate::styling::*;
|
use crate::styling::*;
|
||||||
use chrono::{Days, Local, Utc};
|
use chrono::{Days, Local, Utc};
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
@@ -227,8 +228,7 @@ impl NavigatedPage<RepetitionsMessage> for RepetitionsState {
|
|||||||
row![
|
row![
|
||||||
column![
|
column![
|
||||||
scrollable(self.decks_list()).height(Fill),
|
scrollable(self.decks_list()).height(Fill),
|
||||||
button("Добавить")
|
jl_button!("Добавить")
|
||||||
.style(jl_button)
|
|
||||||
.width(Fill)
|
.width(Fill)
|
||||||
.on_press(CreateSet),
|
.on_press(CreateSet),
|
||||||
]
|
]
|
||||||
@@ -331,8 +331,7 @@ impl RepetitionsState {
|
|||||||
column![
|
column![
|
||||||
text!("Фильтр"),
|
text!("Фильтр"),
|
||||||
text_input("", &deck.filter).on_input(SetFilter),
|
text_input("", &deck.filter).on_input(SetFilter),
|
||||||
button("Проверить фильтр")
|
jl_button!("Проверить фильтр")
|
||||||
.style(jl_button)
|
|
||||||
.on_press(TryFilter),
|
.on_press(TryFilter),
|
||||||
self.count_view(deck),
|
self.count_view(deck),
|
||||||
]
|
]
|
||||||
@@ -361,7 +360,7 @@ impl RepetitionsState {
|
|||||||
Some(deck.open_mode),
|
Some(deck.open_mode),
|
||||||
SetOpenMode
|
SetOpenMode
|
||||||
),
|
),
|
||||||
button("История").style(jl_button).on_press(GoToHistory),
|
jl_button!("История").on_press(GoToHistory),
|
||||||
]
|
]
|
||||||
.spacing(HALF_SPACING)
|
.spacing(HALF_SPACING)
|
||||||
}
|
}
|
||||||
@@ -378,7 +377,7 @@ impl RepetitionsState {
|
|||||||
)
|
)
|
||||||
.height(Fill),
|
.height(Fill),
|
||||||
row![
|
row![
|
||||||
button("Сохранить").style(jl_button).on_press(Save),
|
jl_button!("Сохранить").on_press(Save),
|
||||||
self.launch_delete_button(deck)
|
self.launch_delete_button(deck)
|
||||||
]
|
]
|
||||||
.spacing(DEFAULT_SPACING)
|
.spacing(DEFAULT_SPACING)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ use iced_core::Background;
|
|||||||
use iced_core::Color;
|
use iced_core::Color;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use crate::jl_button;
|
||||||
|
|
||||||
pub struct SelectorState {
|
pub struct SelectorState {
|
||||||
pub set: KanaSet,
|
pub set: KanaSet,
|
||||||
@@ -81,9 +82,8 @@ impl NavigatedPage<SelectorMessage> for SelectorState {
|
|||||||
container(
|
container(
|
||||||
iced::widget::column![
|
iced::widget::column![
|
||||||
row![
|
row![
|
||||||
button("あ ↔ ア")
|
jl_button!("あ ↔ ア")
|
||||||
.on_press(SelectorMessage::Change)
|
.on_press(SelectorMessage::Change),
|
||||||
.style(jl_button),
|
|
||||||
button("Словарь")
|
button("Словарь")
|
||||||
.on_press(SelectorMessage::ToDictionary)
|
.on_press(SelectorMessage::ToDictionary)
|
||||||
.style(Self::nav_style),
|
.style(Self::nav_style),
|
||||||
|
|||||||
+6
-8
@@ -6,6 +6,7 @@ use crate::navigation::Page::PreviousPage;
|
|||||||
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
||||||
use crate::notification::{NotificationData, NotificationRequest};
|
use crate::notification::{NotificationData, NotificationRequest};
|
||||||
use crate::pages::sync::SyncMessage::*;
|
use crate::pages::sync::SyncMessage::*;
|
||||||
|
use crate::jl_button;
|
||||||
use crate::styling::*;
|
use crate::styling::*;
|
||||||
use crate::{push_error, push_error_task};
|
use crate::{push_error, push_error_task};
|
||||||
use iced::widget::button::danger;
|
use iced::widget::button::danger;
|
||||||
@@ -221,14 +222,13 @@ impl SyncState {
|
|||||||
.padding(3)
|
.padding(3)
|
||||||
)
|
)
|
||||||
.style(rounded_box),
|
.style(rounded_box),
|
||||||
button("Скопировать в буфер обмена")
|
jl_button!("Скопировать в буфер обмена")
|
||||||
.style(jl_button)
|
|
||||||
.on_press(CopyKey)
|
.on_press(CopyKey)
|
||||||
.width(Fill),
|
.width(Fill),
|
||||||
row![
|
row![
|
||||||
button("↑ Отправить").style(jl_button).on_press(Send),
|
jl_button!("↑ Отправить").on_press(Send),
|
||||||
space().width(Fill),
|
space().width(Fill),
|
||||||
button("↓ Скачать").style(jl_button).on_press(GetLast)
|
jl_button!("↓ Скачать").on_press(GetLast)
|
||||||
]
|
]
|
||||||
.spacing(DEFAULT_SPACING),
|
.spacing(DEFAULT_SPACING),
|
||||||
toggler(self.auto_fetch)
|
toggler(self.auto_fetch)
|
||||||
@@ -241,11 +241,9 @@ impl SyncState {
|
|||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
column![
|
column![
|
||||||
button("Создать сохранение")
|
jl_button!("Создать сохранение")
|
||||||
.style(jl_button)
|
|
||||||
.on_press(InitSync),
|
.on_press(InitSync),
|
||||||
button("Вставить ключ из буфера")
|
jl_button!("Вставить ключ из буфера")
|
||||||
.style(jl_button)
|
|
||||||
.on_press(GetKey),
|
.on_press(GetKey),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
use crate::core::kana_set::KanaSet;
|
use crate::core::kana_set::KanaSet;
|
||||||
use crate::navigation::Page::PreviousPage;
|
use crate::navigation::Page::PreviousPage;
|
||||||
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
use crate::navigation::{NavigatedPage, Page, RootMessage};
|
||||||
|
use crate::jl_button;
|
||||||
use crate::styling::*;
|
use crate::styling::*;
|
||||||
use iced::widget::*;
|
use iced::widget::*;
|
||||||
use iced::{Element, Fill, Task, alignment};
|
use iced::{Element, Fill, Task, alignment};
|
||||||
@@ -45,11 +46,9 @@ impl NavigatedPage<WritingMessage> for WritingState {
|
|||||||
text!("{}", self.kana).size(48),
|
text!("{}", self.kana).size(48),
|
||||||
self.answers(),
|
self.answers(),
|
||||||
row![
|
row![
|
||||||
button(text!("{}", self.next_text))
|
jl_button!(text!("{}", self.next_text))
|
||||||
.style(jl_button)
|
|
||||||
.on_press(WritingMessage::Next),
|
.on_press(WritingMessage::Next),
|
||||||
button("Закончить")
|
jl_button!("Закончить")
|
||||||
.style(jl_button)
|
|
||||||
.on_press(WritingMessage::Back),
|
.on_press(WritingMessage::Back),
|
||||||
]
|
]
|
||||||
.spacing(DEFAULT_SPACING)
|
.spacing(DEFAULT_SPACING)
|
||||||
|
|||||||
+10
-3
@@ -1,7 +1,7 @@
|
|||||||
use iced::Element;
|
use iced::Element;
|
||||||
use iced::border::Radius;
|
use iced::border::Radius;
|
||||||
use iced::widget::button::*;
|
use iced::widget::button::*;
|
||||||
use iced::widget::{button, container};
|
use iced::widget::container;
|
||||||
use iced_core::Length::Fill;
|
use iced_core::Length::Fill;
|
||||||
use iced_core::alignment::Horizontal::Left;
|
use iced_core::alignment::Horizontal::Left;
|
||||||
use iced_core::{Border, Theme};
|
use iced_core::{Border, Theme};
|
||||||
@@ -14,7 +14,7 @@ pub const BUTTON_RADIUS: f32 = 8.0;
|
|||||||
|
|
||||||
pub const SETTINGS_ICON: &[u8] = include_bytes!("../settings_icon.svg");
|
pub const SETTINGS_ICON: &[u8] = include_bytes!("../settings_icon.svg");
|
||||||
|
|
||||||
pub fn jl_button(theme: &Theme, status: Status) -> Style {
|
pub fn jl_button_style(theme: &Theme, status: Status) -> Style {
|
||||||
let mut style = primary(theme, status);
|
let mut style = primary(theme, status);
|
||||||
style.border = Border {
|
style.border = Border {
|
||||||
color: Default::default(),
|
color: Default::default(),
|
||||||
@@ -30,10 +30,17 @@ pub fn cta_button(theme: &Theme, status: Status) -> Style {
|
|||||||
style
|
style
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[macro_export]
|
||||||
|
macro_rules! jl_button {
|
||||||
|
($content:expr) => {
|
||||||
|
iced::widget::button($content).style($crate::styling::jl_button_style)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
pub fn back_overlay<'a, T: Clone + 'a>(content: Element<'a, T>, back_message: T) -> Element<'a, T> {
|
pub fn back_overlay<'a, T: Clone + 'a>(content: Element<'a, T>, back_message: T) -> Element<'a, T> {
|
||||||
container(
|
container(
|
||||||
iced::widget::column![
|
iced::widget::column![
|
||||||
button("Назад").style(jl_button).on_press(back_message),
|
jl_button!("Назад").on_press(back_message),
|
||||||
content
|
content
|
||||||
]
|
]
|
||||||
.spacing(DEFAULT_SPACING)
|
.spacing(DEFAULT_SPACING)
|
||||||
|
|||||||
Reference in new issue
Block a user