Introduce StyleSheet for Text widget
This commit is contained in:
parent
c807abdfd7
commit
1dd1a2f97f
28 changed files with 183 additions and 87 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue