From 1dd1a2f97fc747e15e12b5188dad6c41b0d052ea Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 29 Jun 2022 10:51:01 +0200 Subject: Introduce `StyleSheet` for `Text` widget --- examples/pure/component/src/main.rs | 10 ++++++---- examples/pure/pane_grid/src/main.rs | 2 +- examples/pure/todos/src/main.rs | 6 +++--- examples/pure/tour/src/main.rs | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) (limited to 'examples/pure') diff --git a/examples/pure/component/src/main.rs b/examples/pure/component/src/main.rs index 31592dbf..64935afd 100644 --- a/examples/pure/component/src/main.rs +++ b/examples/pure/component/src/main.rs @@ -89,8 +89,9 @@ mod numeric_input { impl Component for NumericInput where Renderer: text::Renderer + 'static, - Renderer::Theme: - widget::button::StyleSheet + widget::text_input::StyleSheet, + Renderer::Theme: widget::button::StyleSheet + + widget::text_input::StyleSheet + + widget::text::StyleSheet, { type State = (); type Event = Event; @@ -161,8 +162,9 @@ mod numeric_input { where Message: 'a, Renderer: 'static + text::Renderer, - Renderer::Theme: - widget::button::StyleSheet + widget::text_input::StyleSheet, + Renderer::Theme: widget::button::StyleSheet + + widget::text_input::StyleSheet + + widget::text::StyleSheet, { fn from(numeric_input: NumericInput) -> Self { pure::component(numeric_input) diff --git a/examples/pure/pane_grid/src/main.rs b/examples/pure/pane_grid/src/main.rs index 077e116b..e85ed78d 100644 --- a/examples/pure/pane_grid/src/main.rs +++ b/examples/pure/pane_grid/src/main.rs @@ -168,7 +168,7 @@ impl Application for Example { let title = row() .push(pin_button) .push("Pane") - .push(text(pane.id.to_string()).color(if is_focused { + .push(text(pane.id.to_string()).style(if is_focused { PANE_ID_COLOR_FOCUSED } else { PANE_ID_COLOR_UNFOCUSED diff --git a/examples/pure/todos/src/main.rs b/examples/pure/todos/src/main.rs index ea772def..723386ad 100644 --- a/examples/pure/todos/src/main.rs +++ b/examples/pure/todos/src/main.rs @@ -6,7 +6,7 @@ use iced::pure::{ }; use iced::theme::{self, Theme}; use iced::window; -use iced::{Command, Font, Length, Settings}; +use iced::{Color, Command, Font, Length, Settings}; use serde::{Deserialize, Serialize}; pub fn main() -> iced::Result { @@ -155,7 +155,7 @@ impl Application for Todos { let title = text("todos") .width(Length::Fill) .size(100) - .color([0.5, 0.5, 0.5]) + .style(Color::from([0.5, 0.5, 0.5])) .horizontal_alignment(alignment::Horizontal::Center); let input = text_input( @@ -406,7 +406,7 @@ fn empty_message(message: &str) -> Element<'_, Message> { .width(Length::Fill) .size(25) .horizontal_alignment(alignment::Horizontal::Center) - .color([0.7, 0.7, 0.7]), + .style(Color::from([0.7, 0.7, 0.7])), ) .width(Length::Fill) .height(Length::Units(200)) diff --git a/examples/pure/tour/src/main.rs b/examples/pure/tour/src/main.rs index 700e4216..477a1ec7 100644 --- a/examples/pure/tour/src/main.rs +++ b/examples/pure/tour/src/main.rs @@ -433,7 +433,7 @@ impl<'a> Step { .padding(20) .spacing(20) .push("And its color:") - .push(text(format!("{:?}", color)).color(color)) + .push(text(format!("{:?}", color)).style(color)) .push(color_sliders); Self::container("Text") @@ -576,7 +576,7 @@ impl<'a> Step { .push(if cfg!(target_arch = "wasm32") { Element::new( text("Not available on web yet!") - .color([0.7, 0.7, 0.7]) + .style(Color::from([0.7, 0.7, 0.7])) .horizontal_alignment(alignment::Horizontal::Center), ) } else { -- cgit