summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-06-29 10:51:01 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-06-29 10:51:01 +0200
commit1dd1a2f97fc747e15e12b5188dad6c41b0d052ea (patch)
treeba2b24b9c8dec02b9232068dee299ca27a4823ba /examples
parentc807abdfd70c49b0c93868c12f142a2fb4c08036 (diff)
downloadiced-1dd1a2f97fc747e15e12b5188dad6c41b0d052ea.tar.gz
iced-1dd1a2f97fc747e15e12b5188dad6c41b0d052ea.tar.bz2
iced-1dd1a2f97fc747e15e12b5188dad6c41b0d052ea.zip
Introduce `StyleSheet` for `Text` widget
Diffstat (limited to 'examples')
-rw-r--r--examples/component/src/main.rs10
-rw-r--r--examples/integration_opengl/src/controls.rs4
-rw-r--r--examples/integration_wgpu/src/controls.rs4
-rw-r--r--examples/pane_grid/src/main.rs2
-rw-r--r--examples/pokedex/src/main.rs4
-rw-r--r--examples/pure/component/src/main.rs10
-rw-r--r--examples/pure/pane_grid/src/main.rs2
-rw-r--r--examples/pure/todos/src/main.rs6
-rw-r--r--examples/pure/tour/src/main.rs4
-rw-r--r--examples/qr_code/src/main.rs5
-rw-r--r--examples/todos/src/main.rs8
-rw-r--r--examples/tour/src/main.rs4
-rw-r--r--examples/websocket/src/main.rs2
13 files changed, 36 insertions, 29 deletions
diff --git a/examples/component/src/main.rs b/examples/component/src/main.rs
index 73bbbe35..b6ff0600 100644
--- a/examples/component/src/main.rs
+++ b/examples/component/src/main.rs
@@ -54,7 +54,7 @@ mod numeric_input {
use iced_native::text;
use iced_native::widget::button::{self, Button};
use iced_native::widget::text_input::{self, TextInput};
- use iced_native::widget::{Row, Text};
+ use iced_native::widget::{self, Row, Text};
use iced_native::{Element, Length};
pub struct NumericInput<'a, Message> {
@@ -95,7 +95,9 @@ mod numeric_input {
for NumericInput<'a, Message>
where
Renderer: 'a + text::Renderer,
- Renderer::Theme: button::StyleSheet + text_input::StyleSheet,
+ Renderer::Theme: button::StyleSheet
+ + text_input::StyleSheet
+ + widget::text::StyleSheet,
{
type Event = Event;
@@ -173,7 +175,9 @@ mod numeric_input {
where
Message: 'a,
Renderer: text::Renderer + 'a,
- Renderer::Theme: button::StyleSheet + text_input::StyleSheet,
+ Renderer::Theme: button::StyleSheet
+ + text_input::StyleSheet
+ + widget::text::StyleSheet,
{
fn from(numeric_input: NumericInput<'a, Message>) -> Self {
component::view(numeric_input)
diff --git a/examples/integration_opengl/src/controls.rs b/examples/integration_opengl/src/controls.rs
index f387b4e5..fdaa29d5 100644
--- a/examples/integration_opengl/src/controls.rs
+++ b/examples/integration_opengl/src/controls.rs
@@ -89,13 +89,13 @@ impl Program for Controls {
.spacing(10)
.push(
Text::new("Background color")
- .color(Color::WHITE),
+ .style(Color::WHITE),
)
.push(sliders)
.push(
Text::new(format!("{:?}", background_color))
.size(14)
- .color(Color::WHITE),
+ .style(Color::WHITE),
),
),
)
diff --git a/examples/integration_wgpu/src/controls.rs b/examples/integration_wgpu/src/controls.rs
index 9bca40eb..cb2c423f 100644
--- a/examples/integration_wgpu/src/controls.rs
+++ b/examples/integration_wgpu/src/controls.rs
@@ -100,13 +100,13 @@ impl Program for Controls {
.spacing(10)
.push(
Text::new("Background color")
- .color(Color::WHITE),
+ .style(Color::WHITE),
)
.push(sliders)
.push(
Text::new(format!("{:?}", background_color))
.size(14)
- .color(Color::WHITE),
+ .style(Color::WHITE),
)
.push(TextInput::new(
t,
diff --git a/examples/pane_grid/src/main.rs b/examples/pane_grid/src/main.rs
index fca1116e..5fbcea2c 100644
--- a/examples/pane_grid/src/main.rs
+++ b/examples/pane_grid/src/main.rs
@@ -180,7 +180,7 @@ impl Application for Example {
pin_button.into(),
Text::new("Pane").into(),
Text::new(content.id.to_string())
- .color(if is_focused {
+ .style(if is_focused {
PANE_ID_COLOR_FOCUSED
} else {
PANE_ID_COLOR_UNFOCUSED
diff --git a/examples/pokedex/src/main.rs b/examples/pokedex/src/main.rs
index 4b0e913d..89d865e4 100644
--- a/examples/pokedex/src/main.rs
+++ b/examples/pokedex/src/main.rs
@@ -2,7 +2,7 @@ use iced::button;
use iced::futures;
use iced::image;
use iced::{
- Alignment, Application, Button, Column, Command, Container, Element,
+ Alignment, Application, Button, Color, Column, Command, Container, Element,
Length, Row, Settings, Text, Theme,
};
@@ -143,7 +143,7 @@ impl Pokemon {
.push(
Text::new(format!("#{}", self.number))
.size(20)
- .color([0.5, 0.5, 0.5]),
+ .style(Color::from([0.5, 0.5, 0.5])),
),
)
.push(Text::new(&self.description)),
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<Message, Renderer> Component<Message, Renderer> for NumericInput<Message>
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<Message>) -> 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 {
diff --git a/examples/qr_code/src/main.rs b/examples/qr_code/src/main.rs
index 92c82d45..3e9ba921 100644
--- a/examples/qr_code/src/main.rs
+++ b/examples/qr_code/src/main.rs
@@ -1,7 +1,8 @@
use iced::qr_code::{self, QRCode};
use iced::text_input::{self, TextInput};
use iced::{
- Alignment, Column, Container, Element, Length, Sandbox, Settings, Text,
+ Alignment, Color, Column, Container, Element, Length, Sandbox, Settings,
+ Text,
};
pub fn main() -> iced::Result {
@@ -48,7 +49,7 @@ impl Sandbox for QRGenerator {
fn view(&mut self) -> Element<Message> {
let title = Text::new("QR Code Generator")
.size(70)
- .color([0.5, 0.5, 0.5]);
+ .style(Color::from([0.5, 0.5, 0.5]));
let input = TextInput::new(
&mut self.input,
diff --git a/examples/todos/src/main.rs b/examples/todos/src/main.rs
index 453cddc3..dc080ef5 100644
--- a/examples/todos/src/main.rs
+++ b/examples/todos/src/main.rs
@@ -4,8 +4,8 @@ use iced::scrollable::{self, Scrollable};
use iced::text_input::{self, TextInput};
use iced::theme::{self, Theme};
use iced::{
- Application, Checkbox, Column, Command, Container, Element, Font, Length,
- Row, Settings, Text,
+ Application, Checkbox, Color, Column, Command, Container, Element, Font,
+ Length, Row, Settings, Text,
};
use serde::{Deserialize, Serialize};
@@ -155,7 +155,7 @@ impl Application for Todos {
let title = Text::new("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 = TextInput::new(
@@ -453,7 +453,7 @@ fn empty_message<'a>(message: &str) -> Element<'a, 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/tour/src/main.rs b/examples/tour/src/main.rs
index 155592d5..22cfaa57 100644
--- a/examples/tour/src/main.rs
+++ b/examples/tour/src/main.rs
@@ -584,7 +584,7 @@ impl<'a> Step {
.padding(20)
.spacing(20)
.push(Text::new("And its color:"))
- .push(Text::new(format!("{:?}", color)).color(color))
+ .push(Text::new(format!("{:?}", color)).style(color))
.push(color_sliders);
Self::container("Text")
@@ -766,7 +766,7 @@ impl<'a> Step {
.push(if cfg!(target_arch = "wasm32") {
Element::new(
Text::new("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 {
diff --git a/examples/websocket/src/main.rs b/examples/websocket/src/main.rs
index 65120710..64addc8f 100644
--- a/examples/websocket/src/main.rs
+++ b/examples/websocket/src/main.rs
@@ -92,7 +92,7 @@ impl Application for WebSocket {
let message_log = if self.messages.is_empty() {
Container::new(
Text::new("Your messages will appear here...")
- .color(Color::from_rgb8(0x88, 0x88, 0x88)),
+ .style(Color::from_rgb8(0x88, 0x88, 0x88)),
)
.width(Length::Fill)
.height(Length::Fill)