From 664251f3f5c7b76f69a97683af1468094bba887f Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector0193@gmail.com>
Date: Sat, 14 May 2022 01:47:55 +0200
Subject: Draft first-class `Theme` support

RFC: https://github.com/iced-rs/rfcs/pull/6
---
 examples/pokedex/src/main.rs | 36 ++++++++----------------------------
 1 file changed, 8 insertions(+), 28 deletions(-)

(limited to 'examples/pokedex/src/main.rs')

diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs
index 85c26987..4b0e913d 100644
--- a/examples/pokedex/src/main.rs
+++ b/examples/pokedex/src/main.rs
@@ -1,6 +1,9 @@
+use iced::button;
+use iced::futures;
+use iced::image;
 use iced::{
-    button, futures, image, Alignment, Application, Button, Column, Command,
-    Container, Element, Length, Row, Settings, Text,
+    Alignment, Application, Button, Column, Command, Container, Element,
+    Length, Row, Settings, Text, Theme,
 };
 
 pub fn main() -> iced::Result {
@@ -26,8 +29,9 @@ enum Message {
 }
 
 impl Application for Pokedex {
-    type Executor = iced::executor::Default;
     type Message = Message;
+    type Theme = Theme;
+    type Executor = iced::executor::Default;
     type Flags = ();
 
     fn new(_flags: ()) -> (Pokedex, Command<Message>) {
@@ -238,29 +242,5 @@ impl From<reqwest::Error> for Error {
 }
 
 fn button<'a>(state: &'a mut button::State, text: &str) -> Button<'a, Message> {
-    Button::new(state, Text::new(text))
-        .padding(10)
-        .style(style::Button::Primary)
-}
-
-mod style {
-    use iced::{button, Background, Color, Vector};
-
-    pub enum Button {
-        Primary,
-    }
-
-    impl button::StyleSheet for Button {
-        fn active(&self) -> button::Style {
-            button::Style {
-                background: Some(Background::Color(match self {
-                    Button::Primary => Color::from_rgb(0.11, 0.42, 0.87),
-                })),
-                border_radius: 12.0,
-                shadow_offset: Vector::new(1.0, 1.0),
-                text_color: Color::WHITE,
-                ..button::Style::default()
-            }
-        }
-    }
+    Button::new(state, Text::new(text)).padding(10)
 }
-- 
cgit