Skip to content

Commit

Permalink
update theme and style for modals (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
darrell-roberts authored Dec 30, 2024
1 parent 3db636b commit d4209b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
10 changes: 4 additions & 6 deletions minesweeper-iced/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use iced::{
widget::{button, column, container, row, text, Column, Row},
Color, Element, Length, Task,
Element, Length, Task,
};
use minesweeper::{
history::{load_wins, save_win, WinHistory},
Expand Down Expand Up @@ -134,7 +134,7 @@ impl AppState {
if let Some(outcome) = self.outcome.as_ref() {
modal(
content,
container(text(outcome))
container(text(outcome).size(24))
.center_x(Length::Fill)
.padding(20)
.width(200)
Expand All @@ -155,8 +155,6 @@ impl AppState {
}
}

fn modal_content_style(_theme: &iced::Theme) -> container::Style {
container::Style::default()
.background(Color::from_rgba8(0, 153, 204, 0.7))
.border(iced::border::rounded(15))
fn modal_content_style(theme: &iced::Theme) -> container::Style {
container::dark(theme).border(iced::border::rounded(15))
}
1 change: 1 addition & 0 deletions minesweeper-iced/src/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ where
.align_top(Length::Fill)
.width(Length::Fill)
.center_x(Length::Fill)
.center_y(Length::Fill)
.padding(padding::top(10))
.style(|_theme| {
container::Style {
Expand Down
13 changes: 5 additions & 8 deletions minesweeper-iced/src/views/scoreboard.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::format_elapsed;
use iced::{
widget::{container, row, text, Column},
Color, Element,
Element,
};
use minesweeper::history::Win;

Expand All @@ -24,16 +24,13 @@ impl<'a> ScoreBoard<'a> {
.zip(1..)
.fold(Column::new(), |col, (win, rank)| {
let row = row![
container(text(format!("{rank:<5}"))).width(20),
container(text(format_elapsed(win.duration))).width(200),
text(format!("{}", win.date.format("%b %d %Y %I:%M%P")))
container(text(format!("{rank:<5}")).size(20)).width(25),
container(text(format_elapsed(win.duration)).size(20)).width(250),
text(format!("{}", win.date.format("%b %d %Y %I:%M%P"))).size(20)
]
.spacing(10);
col.push(row).spacing(10)
});
container(col)
.padding(20)
.style(|_| container::Style::default().background(Color::from_rgb8(0, 153, 204)))
.into()
container(col).padding(20).into()
}
}

0 comments on commit d4209b9

Please sign in to comment.