Skip to content

Commit

Permalink
table adjustments (still not appearing) and button text fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
yeastplume committed Apr 2, 2024
1 parent fa83423 commit 8fb807a
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 140 deletions.
223 changes: 111 additions & 112 deletions Cargo.lock

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions crates/core/src/style/table_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl StyleSheet for Theme {
fn appearance(&self, style: &Self::Style) -> Appearance {
match style {
TableRowStyle::Default => Appearance {
text_color: Some(self.palette.normal.primary),
text_color: Some(self.palette.bright.primary),
background: Some(Background::Color(self.palette.normal.primary)),
border_radius: 0.0,
border_width: 0.0,
Expand All @@ -51,14 +51,15 @@ impl StyleSheet for Theme {
offset_right: 0.0,
},
TableRowStyle::TableRowAlternate => Appearance {
text_color: Some(self.palette.bright.primary),
background: Some(Background::Color(Color {
a: 0.50,
..self.palette.normal.primary
})),
..Appearance::default()
},
TableRowStyle::TableRowHighlife => Appearance {
text_color: Some(self.palette.normal.primary),
text_color: Some(self.palette.bright.primary),
background: Some(Background::Color(Color {
a: 0.30,
..self.palette.normal.primary
Expand All @@ -70,7 +71,7 @@ impl StyleSheet for Theme {
offset_right: 0.0,
},
TableRowStyle::TableRowLowlife => Appearance {
text_color: Some(self.palette.normal.primary),
text_color: Some(self.palette.bright.primary),
background: Some(Background::Color(Color::TRANSPARENT)),
border_radius: 0.0,
border_width: 0.0,
Expand All @@ -79,7 +80,7 @@ impl StyleSheet for Theme {
offset_right: 0.0,
},
TableRowStyle::TableRowSelected => Appearance {
text_color: Some(self.palette.normal.primary),
text_color: Some(self.palette.bright.primary),
background: Some(Background::Color(self.palette.normal.primary)),
border_radius: 0.0,
border_width: 0.0,
Expand Down
6 changes: 3 additions & 3 deletions crates/core/src/theme/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl button::StyleSheet for Theme {
..button::Appearance::default()
},
ButtonStyle::NormalText => button::Appearance {
text_color: self.palette.normal.surface,
text_color: self.palette.bright.primary,
border: Border {
color: self.palette.normal.primary,
width: 1.0,
Expand Down Expand Up @@ -144,14 +144,14 @@ impl button::StyleSheet for Theme {
})),
text_color: Color {
a: 0.50,
..self.palette.normal.primary
..self.palette.bright.primary
},
..self.active(style)
},
ButtonStyle::Primary => button::Appearance {
text_color: Color {
a: 0.25,
..self.palette.normal.surface
..self.palette.bright.primary
},
..self.active(style)
},
Expand Down
1 change: 1 addition & 0 deletions crates/core/src/theme/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl container::StyleSheet for Theme {
..container::Appearance::default()
},
ContainerStyle::Segmented => container::Appearance {
text_color: Some(self.palette.bright.primary),
border: Border {
color: self.palette.normal.primary,
width: 1.0,
Expand Down
8 changes: 5 additions & 3 deletions crates/core/src/widget/table_row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ where
renderer: &Renderer,
limits: &layout::Limits,
) -> layout::Node {
let limits = limits.loose().width(self.height).height(self.height);
//.padding();
// TODO: Above?
let limits = limits
.loose()
.width(self.width)
.height(self.height)
.shrink(self.padding);

let mut content = self
.content
Expand Down
2 changes: 1 addition & 1 deletion src/gui/element/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ pub static DEFAULT_SUB_HEADER_FONT_SIZE: u16 = 18;
pub static DEFAULT_PADDING: f32 = 10.0;

pub static BUTTON_WIDTH: f32 = 84.0;
pub static BUTTON_HEIGHT: f32 = 16.0;
pub static BUTTON_HEIGHT: f32 = 20.0;
17 changes: 7 additions & 10 deletions src/gui/element/wallet/operation/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,11 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain
.align_x(alignment::Horizontal::Center);

let mut submit_button = Button::new(submit_button_label_container)
.on_press(Interaction::WalletOperationOpenViewInteraction(
LocalViewInteraction::OpenWallet,
))
.style(grin_gui_core::theme::ButtonStyle::Primary);

submit_button = submit_button.on_press(Interaction::WalletOperationOpenViewInteraction(
LocalViewInteraction::OpenWallet,
));

let submit_button: Element<Interaction> = submit_button.into();

let cancel_button_label_container =
Expand All @@ -249,20 +248,18 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain
// &mut state.cancel_button_state,
cancel_button_label_container,
)
.style(grin_gui_core::theme::ButtonStyle::Primary);

cancel_button = cancel_button.on_press(Interaction::WalletOperationOpenViewInteraction(
.on_press(Interaction::WalletOperationOpenViewInteraction(
LocalViewInteraction::CancelOpenWallet,
));
))
.style(grin_gui_core::theme::ButtonStyle::Primary);
let cancel_button: Element<Interaction> = cancel_button.into();

// give our buttons a nice double bordered look to match toolbar buttons
let submit_button: Element<Interaction> = submit_button.into();
let submit_container = Container::new(submit_button.map(Message::Interaction)).padding(1);
let submit_container = Container::new(submit_container)
.style(grin_gui_core::theme::ContainerStyle::Segmented)
.padding(1);

let cancel_button: Element<Interaction> = cancel_button.into();
let cancel_container = Container::new(cancel_button.map(Message::Interaction)).padding(1);
let cancel_container = Container::new(cancel_container)
.style(grin_gui_core::theme::ContainerStyle::Segmented)
Expand Down
17 changes: 10 additions & 7 deletions src/gui/element/wallet/setup/wallet_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain
let wallet_name = Text::new(w.display_name.clone()).size(DEFAULT_FONT_SIZE);
let chain_name = Text::new(w.chain_type.shortname()).size(DEFAULT_FONT_SIZE);

let mut wallet_name_container = Container::new(wallet_name)
/*let mut wallet_name_container = Container::new(wallet_name)
.style(grin_gui_core::theme::ContainerStyle::HoverableForeground);
let mut wallet_chain_container = Container::new(chain_name)
Expand All @@ -284,11 +284,11 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain
.style(grin_gui_core::theme::ContainerStyle::HoverableBrightForeground);
wallet_directory_container = wallet_directory_container
.style(grin_gui_core::theme::ContainerStyle::HoverableBrightForeground);
}
}*/

let wallet_row = Row::new()
// .push(checkbox)
.push(
/* .push(
Column::new()
.push(wallet_name_container)
.width(Length::FillPortion(1)),
Expand All @@ -302,7 +302,8 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain
Column::new()
.push(wallet_directory_container)
.width(Length::FillPortion(3)),
);
)*/
.push(Text::new("arse").size(DEFAULT_FONT_SIZE));

let mut table_row = TableRow::new(wallet_row)
.padding(iced::Padding::from(9))
Expand All @@ -329,11 +330,14 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain
}
}

let table_row: Element<Interaction> = table_row.into();
wallet_rows.push(table_row);
}

let wallet_column = Column::new().push(Column::with_children(
wallet_rows.into_iter().map(|row| row.into()),
wallet_rows
.into_iter()
.map(|row| row.map(Message::Interaction)),
));

let load_wallet_button_container =
Expand Down Expand Up @@ -398,8 +402,7 @@ pub fn data_container<'a>(state: &'a StateContainer, config: &Config) -> Contain

let row = Row::new().push(
Column::new()
// TODO: Find out why this isn't working
//.push(table_container)
.push(table_container)
.push(Space::with_height(Length::Fixed(DEFAULT_PADDING)))
.push(button_row),
);
Expand Down

0 comments on commit 8fb807a

Please sign in to comment.