diff options
author | 2023-05-19 03:47:00 +0200 | |
---|---|---|
committer | 2023-05-19 03:48:25 +0200 | |
commit | 10a8c599e62e46dad4da0e53e184861047ad34c0 (patch) | |
tree | 2a89b9f51f3df7260f0a7ef35f1feea5183d6346 /examples/tour/src/main.rs | |
parent | 96aa0379d58ff799493097e3bd0572f9a87da453 (diff) | |
download | iced-10a8c599e62e46dad4da0e53e184861047ad34c0.tar.gz iced-10a8c599e62e46dad4da0e53e184861047ad34c0.tar.bz2 iced-10a8c599e62e46dad4da0e53e184861047ad34c0.zip |
Keep `tour` buttons solid
The gradients feel a bit out of place currently.
Diffstat (limited to '')
-rw-r--r-- | examples/tour/src/main.rs | 55 |
1 files changed, 5 insertions, 50 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index 257a4def..13bcd5ff 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -1,15 +1,11 @@ -use iced::gradient; +use iced::alignment; use iced::theme; -use iced::theme::Palette; use iced::widget::{ checkbox, column, container, horizontal_space, image, radio, row, scrollable, slider, text, text_input, toggler, vertical_space, }; use iced::widget::{Button, Column, Container, Slider}; -use iced::{alignment, widget, Theme}; -use iced::{ - Color, Degrees, Element, Font, Length, Radians, Renderer, Sandbox, Settings, -}; +use iced::{Color, Element, Font, Length, Renderer, Sandbox, Settings}; pub fn main() -> iced::Result { env_logger::init(); @@ -59,18 +55,15 @@ impl Sandbox for Tour { controls = controls.push( button("Back") .on_press(Message::BackPressed) - .style(theme::Button::custom(CustomButtonStyle::Secondary)), + .style(theme::Button::Secondary), ); } controls = controls.push(horizontal_space(Length::Fill)); if steps.can_continue() { - controls = controls.push( - button("Next") - .on_press(Message::NextPressed) - .style(theme::Button::custom(CustomButtonStyle::Primary)), - ); + controls = + controls.push(button("Next").on_press(Message::NextPressed)); } let content: Element<_> = column![ @@ -720,41 +713,3 @@ pub enum Layout { Row, Column, } - -enum CustomButtonStyle { - Primary, - Secondary, -} - -impl widget::button::StyleSheet for CustomButtonStyle { - type Style = Theme; - - fn active(&self, _style: &Self::Style) -> widget::button::Appearance { - match self { - CustomButtonStyle::Primary => widget::button::Appearance { - background: Some( - gradient::Linear::new(Degrees(270.0)) - .add_stop(0.0, Palette::LIGHT.primary) - .add_stop(1.0, Color::from_rgb8(54, 80, 168)) - .into(), - ), - text_color: Color::WHITE, - border_radius: 5.0, - ..Default::default() - }, - CustomButtonStyle::Secondary => widget::button::Appearance { - background: Some( - gradient::Linear::new(Radians( - 3.0 * std::f32::consts::PI / 2.0, - )) - .add_stop(0.0, Color::from_rgb8(194, 194, 194)) - .add_stop(1.0, Color::from_rgb8(126, 126, 126)) - .into(), - ), - text_color: Color::WHITE, - border_radius: 5.0, - ..Default::default() - }, - } - } -} |