Add Renderer::Defaults and style inheritance

This commit is contained in:
Héctor Ramón Jiménez 2019-12-30 12:14:26 +01:00
parent 89a6b8a9a1
commit 8caa66be27
32 changed files with 224 additions and 150 deletions

View File

@ -13,7 +13,7 @@ mod circle {
layout, Background, Color, Element, Hasher, Layout, Length,
MouseCursor, Point, Size, Widget,
};
use iced_wgpu::{Primitive, Renderer};
use iced_wgpu::{Defaults, Primitive, Renderer};
pub struct Circle {
radius: u16,
@ -54,6 +54,7 @@ mod circle {
fn draw(
&self,
_renderer: &mut Renderer,
_defaults: &Defaults,
layout: Layout<'_>,
_cursor_position: Point,
) -> (Primitive, MouseCursor) {

View File

@ -1,6 +1,6 @@
use iced::{
button, image, Align, Application, Button, Color, Column, Command,
Container, Element, Image, Length, Row, Settings, Text,
button, image, Align, Application, Button, Column, Command, Container,
Element, Image, Length, Row, Settings, Text,
};
pub fn main() {
@ -219,7 +219,7 @@ impl From<surf::Exception> for Error {
}
fn button<'a>(state: &'a mut button::State, text: &str) -> Button<'a, Message> {
Button::new(state, Text::new(text).color(Color::WHITE))
Button::new(state, Text::new(text))
.padding(10)
.style(style::Button::Primary)
}
@ -239,6 +239,7 @@ mod style {
})),
border_radius: 12,
shadow_offset: 1.0,
text_color: Color::WHITE,
}
}
}

View File

@ -1,6 +1,6 @@
use iced::{
button, Align, Application, Button, Color, Column, Command, Container,
Element, HorizontalAlignment, Length, Row, Settings, Subscription, Text,
button, Align, Application, Button, Column, Command, Container, Element,
HorizontalAlignment, Length, Row, Settings, Subscription, Text,
};
use std::time::{Duration, Instant};
@ -102,7 +102,6 @@ impl Application for Stopwatch {
Button::new(
state,
Text::new(label)
.color(Color::WHITE)
.horizontal_alignment(HorizontalAlignment::Center),
)
.min_width(80)
@ -199,6 +198,7 @@ mod style {
})),
border_radius: 12,
shadow_offset: 1.0,
text_color: Color::WHITE,
}
}
}

View File

@ -1,7 +1,7 @@
use iced::{
button, scrollable, text_input, Align, Application, Button, Checkbox,
Color, Column, Command, Container, Element, Font, HorizontalAlignment,
Length, Row, Scrollable, Settings, Text, TextInput,
Column, Command, Container, Element, Font, HorizontalAlignment, Length,
Row, Scrollable, Settings, Text, TextInput,
};
use serde::{Deserialize, Serialize};
@ -291,13 +291,10 @@ impl Task {
.align_items(Align::Center)
.push(checkbox)
.push(
Button::new(
edit_button,
edit_icon().color([0.5, 0.5, 0.5]),
)
.on_press(TaskMessage::Edit)
.padding(10)
.style(style::Button::NoBackground),
Button::new(edit_button, edit_icon())
.on_press(TaskMessage::Edit)
.padding(10)
.style(style::Button::Icon),
)
.into()
}
@ -321,14 +318,9 @@ impl Task {
.push(
Button::new(
delete_button,
Row::new()
.spacing(10)
.push(delete_icon().color(Color::WHITE))
.push(
Text::new("Delete")
.width(Length::Shrink)
.color(Color::WHITE),
),
Row::new().spacing(10).push(delete_icon()).push(
Text::new("Delete").width(Length::Shrink),
),
)
.on_press(TaskMessage::Delete)
.padding(10)
@ -359,12 +351,10 @@ impl Controls {
let filter_button = |state, label, filter, current_filter| {
let label = Text::new(label).size(16).width(Length::Shrink);
let button = if filter == current_filter {
Button::new(state, label.color(Color::WHITE))
.style(style::Button::FilterSelected)
} else {
Button::new(state, label).style(style::Button::NoBackground)
};
let button =
Button::new(state, label).style(style::Button::Filter {
selected: filter == current_filter,
});
button.on_press(Message::FilterChanged(filter)).padding(8)
};
@ -564,25 +554,38 @@ mod style {
use iced::{button, Background, Color};
pub enum Button {
FilterSelected,
NoBackground,
Filter { selected: bool },
Icon,
Destructive,
}
impl button::StyleSheet for Button {
fn active(&self) -> button::Style {
match self {
Button::FilterSelected => button::Style {
background: Some(Background::Color(Color::from_rgb(
0.2, 0.2, 0.7,
))),
border_radius: 10,
shadow_offset: 0.0,
},
Button::NoBackground => button::Style {
Button::Filter { selected } => {
if *selected {
button::Style {
background: Some(Background::Color(
Color::from_rgb(0.2, 0.2, 0.7),
)),
border_radius: 10,
shadow_offset: 0.0,
text_color: Color::WHITE,
}
} else {
button::Style {
background: None,
border_radius: 0,
shadow_offset: 0.0,
text_color: Color::BLACK,
}
}
}
Button::Icon => button::Style {
background: None,
border_radius: 0,
shadow_offset: 0.0,
text_color: Color::from_rgb(0.5, 0.5, 0.5),
},
Button::Destructive => button::Style {
background: Some(Background::Color(Color::from_rgb(
@ -590,8 +593,25 @@ mod style {
))),
border_radius: 5,
shadow_offset: 1.0,
text_color: Color::WHITE,
},
}
}
fn hovered(&self) -> button::Style {
let active = self.active();
button::Style {
text_color: match self {
Button::Icon => Color::from_rgb(0.2, 0.2, 0.7),
Button::Filter { selected } if !selected => {
Color::from_rgb(0.2, 0.2, 0.7)
}
_ => active.text_color,
},
shadow_offset: active.shadow_offset + 1.0,
..active
}
}
}
}

View File

@ -694,9 +694,7 @@ fn button<'a, Message>(
) -> Button<'a, Message> {
Button::new(
state,
Text::new(label)
.color(Color::WHITE)
.horizontal_alignment(HorizontalAlignment::Center),
Text::new(label).horizontal_alignment(HorizontalAlignment::Center),
)
.padding(12)
.min_width(100)
@ -761,6 +759,15 @@ mod style {
})),
border_radius: 12,
shadow_offset: 1.0,
text_color: Color::from_rgb8(0xEE, 0xEE, 0xEE),
}
}
fn hovered(&self) -> button::Style {
button::Style {
text_color: Color::WHITE,
shadow_offset: 2.0,
..self.active()
}
}
}

View File

@ -235,10 +235,12 @@ where
pub fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
self.widget.draw(renderer, layout, cursor_position)
self.widget
.draw(renderer, defaults, layout, cursor_position)
}
pub(crate) fn hash_layout(&self, state: &mut Hasher) {
@ -316,10 +318,12 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
self.widget.draw(renderer, layout, cursor_position)
self.widget
.draw(renderer, defaults, layout, cursor_position)
}
fn hash_layout(&self, state: &mut Hasher) {
@ -384,10 +388,12 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
renderer.explain(
defaults,
self.element.widget.as_ref(),
layout,
cursor_position,

View File

@ -44,6 +44,8 @@ pub trait Renderer: Sized {
/// [`Renderer`]: trait.Renderer.html
type Output;
type Defaults: Default;
/// Lays out the elements of a user interface.
///
/// You should override this if you need to perform any operations before or

View File

@ -17,6 +17,7 @@ pub trait Debugger: super::Renderer {
/// [`Element::explain`]: struct.Element.html#method.explain
fn explain<Message>(
&mut self,
defaults: &Self::Defaults,
widget: &dyn Widget<Message, Self>,
layout: Layout<'_>,
cursor_position: Point,

View File

@ -5,16 +5,26 @@ use crate::{
};
/// A renderer that does nothing.
///
/// It can be useful if you are writing tests!
#[derive(Debug, Clone, Copy)]
pub struct Null;
impl Null {
pub fn new() -> Null {
Null
}
}
impl Renderer for Null {
type Output = ();
type Defaults = ();
}
impl column::Renderer for Null {
fn draw<Message>(
&mut self,
_defaults: &Self::Defaults,
_content: &[Element<'_, Message, Self>],
_layout: Layout<'_>,
_cursor_position: Point,
@ -25,6 +35,7 @@ impl column::Renderer for Null {
impl row::Renderer for Null {
fn draw<Message>(
&mut self,
_defaults: &Self::Defaults,
_content: &[Element<'_, Message, Self>],
_layout: Layout<'_>,
_cursor_position: Point,
@ -49,6 +60,7 @@ impl text::Renderer for Null {
fn draw(
&mut self,
_defaults: &Self::Defaults,
_bounds: Rectangle,
_content: &str,
_size: u16,
@ -119,13 +131,16 @@ impl text_input::Renderer for Null {
impl button::Renderer for Null {
type Style = ();
fn draw(
fn draw<Message>(
&mut self,
_defaults: &Self::Defaults,
_bounds: Rectangle,
_cursor_position: Point,
_is_disabled: bool,
_is_pressed: bool,
_style: &Self::Style,
_content: Self::Output,
_content: &Element<'_, Message, Self>,
_content_layout: Layout<'_>,
) -> Self::Output {
}
}

View File

@ -43,24 +43,7 @@ where
/// use iced_wgpu::Renderer;
///
/// # mod iced_wgpu {
/// # pub struct Renderer;
/// #
/// # impl Renderer {
/// # pub fn new() -> Self { Renderer }
/// # }
/// #
/// # impl iced_native::Renderer for Renderer { type Output = (); }
/// #
/// # impl iced_native::column::Renderer for Renderer {
/// # fn draw<Message>(
/// # &mut self,
/// # _children: &[iced_native::Element<'_, Message, Self>],
/// # _layout: iced_native::Layout<'_>,
/// # _cursor_position: iced_native::Point,
/// # ) -> Self::Output {
/// # ()
/// # }
/// # }
/// # pub use iced_native::renderer::Null as Renderer;
/// # }
/// #
/// # use iced_native::Column;
@ -139,24 +122,7 @@ where
/// use iced_wgpu::Renderer;
///
/// # mod iced_wgpu {
/// # pub struct Renderer;
/// #
/// # impl Renderer {
/// # pub fn new() -> Self { Renderer }
/// # }
/// #
/// # impl iced_native::Renderer for Renderer { type Output = (); }
/// #
/// # impl iced_native::column::Renderer for Renderer {
/// # fn draw<Message>(
/// # &mut self,
/// # _children: &[iced_native::Element<'_, Message, Self>],
/// # _layout: iced_native::Layout<'_>,
/// # _cursor_position: iced_native::Point,
/// # ) -> Self::Output {
/// # ()
/// # }
/// # }
/// # pub use iced_native::renderer::Null as Renderer;
/// # }
/// #
/// # use iced_native::Column;
@ -241,24 +207,7 @@ where
/// use iced_wgpu::Renderer;
///
/// # mod iced_wgpu {
/// # pub struct Renderer;
/// #
/// # impl Renderer {
/// # pub fn new() -> Self { Renderer }
/// # }
/// #
/// # impl iced_native::Renderer for Renderer { type Output = (); }
/// #
/// # impl iced_native::column::Renderer for Renderer {
/// # fn draw<Message>(
/// # &mut self,
/// # _children: &[iced_native::Element<'_, Message, Self>],
/// # _layout: iced_native::Layout<'_>,
/// # _cursor_position: iced_native::Point,
/// # ) -> Self::Output {
/// # ()
/// # }
/// # }
/// # pub use iced_native::renderer::Null as Renderer;
/// # }
/// #
/// # use iced_native::Column;
@ -304,6 +253,7 @@ where
pub fn draw(&self, renderer: &mut Renderer) -> Renderer::Output {
self.root.widget.draw(
renderer,
&Renderer::Defaults::default(),
Layout::new(&self.layout),
self.cursor_position,
)

View File

@ -101,6 +101,7 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output;

View File

@ -216,21 +216,19 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
let content = self.content.draw(
renderer,
layout.children().next().unwrap(),
cursor_position,
);
renderer.draw(
defaults,
layout.bounds(),
cursor_position,
self.on_press.is_none(),
self.state.is_pressed,
&self.style,
content,
&self.content,
layout.children().next().unwrap(),
)
}
@ -253,13 +251,16 @@ pub trait Renderer: crate::Renderer + Sized {
/// Draws a [`Button`].
///
/// [`Button`]: struct.Button.html
fn draw(
fn draw<Message>(
&mut self,
defaults: &Self::Defaults,
bounds: Rectangle,
cursor_position: Point,
is_disabled: bool,
is_pressed: bool,
style: &Self::Style,
content: Self::Output,
content: &Element<'_, Message, Self>,
content_layout: Layout<'_>,
) -> Self::Output;
}

View File

@ -134,6 +134,7 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
@ -146,6 +147,7 @@ where
let label = text::Renderer::draw(
renderer,
defaults,
label_layout.bounds(),
&self.label,
text::Renderer::default_size(renderer),

View File

@ -173,10 +173,11 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
renderer.draw(&self.children, layout, cursor_position)
renderer.draw(defaults, &self.children, layout, cursor_position)
}
fn hash_layout(&self, state: &mut Hasher) {
@ -213,6 +214,7 @@ pub trait Renderer: crate::Renderer + Sized {
/// [`Layout`]: ../layout/struct.Layout.html
fn draw<Message>(
&mut self,
defaults: &Self::Defaults,
content: &[Element<'_, Message, Self>],
layout: Layout<'_>,
cursor_position: Point,

View File

@ -147,11 +147,13 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
self.content.draw(
renderer,
defaults,
layout.children().next().unwrap(),
cursor_position,
)

View File

@ -95,6 +95,7 @@ where
fn draw(
&self,
renderer: &mut Renderer,
_defaults: &Renderer::Defaults,
layout: Layout<'_>,
_cursor_position: Point,
) -> Renderer::Output {

View File

@ -131,6 +131,7 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
@ -143,6 +144,7 @@ where
let label = text::Renderer::draw(
renderer,
defaults,
label_layout.bounds(),
&self.label,
text::Renderer::default_size(renderer),

View File

@ -174,10 +174,11 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
renderer.draw(&self.children, layout, cursor_position)
renderer.draw(defaults, &self.children, layout, cursor_position)
}
fn hash_layout(&self, state: &mut Hasher) {
@ -215,6 +216,7 @@ pub trait Renderer: crate::Renderer + Sized {
/// [`Layout`]: ../layout/struct.Layout.html
fn draw<Message>(
&mut self,
defaults: &Self::Defaults,
children: &[Element<'_, Message, Self>],
layout: Layout<'_>,
cursor_position: Point,

View File

@ -255,6 +255,7 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {
@ -277,7 +278,12 @@ where
Point::new(cursor_position.x, -1.0)
};
self.content.draw(renderer, content_layout, cursor_position)
self.content.draw(
renderer,
defaults,
content_layout,
cursor_position,
)
};
self::Renderer::draw(

View File

@ -178,6 +178,7 @@ where
fn draw(
&self,
renderer: &mut Renderer,
_defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {

View File

@ -91,6 +91,7 @@ where
fn draw(
&self,
renderer: &mut Renderer,
_defaults: &Renderer::Defaults,
layout: Layout<'_>,
_cursor_position: Point,
) -> Renderer::Output {

View File

@ -146,10 +146,12 @@ where
fn draw(
&self,
renderer: &mut Renderer,
defaults: &Renderer::Defaults,
layout: Layout<'_>,
_cursor_position: Point,
) -> Renderer::Output {
renderer.draw(
defaults,
layout.bounds(),
&self.content,
self.size.unwrap_or(renderer.default_size()),
@ -209,6 +211,7 @@ pub trait Renderer: crate::Renderer {
/// [`VerticalAlignment`]: enum.VerticalAlignment.html
fn draw(
&mut self,
defaults: &Self::Defaults,
bounds: Rectangle,
content: &str,
size: u16,

View File

@ -343,6 +343,7 @@ where
fn draw(
&self,
renderer: &mut Renderer,
_defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point,
) -> Renderer::Output {

27
wgpu/src/defaults.rs Normal file
View File

@ -0,0 +1,27 @@
use iced_native::Color;
#[derive(Debug, Clone, Copy)]
pub struct Defaults {
pub text: Text,
}
impl Default for Defaults {
fn default() -> Defaults {
Defaults {
text: Text::default(),
}
}
}
#[derive(Debug, Clone, Copy)]
pub struct Text {
pub color: Color,
}
impl Default for Text {
fn default() -> Text {
Text {
color: Color::BLACK,
}
}
}

View File

@ -24,6 +24,7 @@
#![deny(unused_results)]
#![deny(unsafe_code)]
#![deny(rust_2018_idioms)]
pub mod defaults;
pub mod widget;
mod image;
@ -33,6 +34,7 @@ mod renderer;
mod text;
mod transformation;
pub use defaults::Defaults;
pub use primitive::Primitive;
pub use renderer::{Renderer, Target};
#[doc(no_inline)]

View File

@ -1,4 +1,6 @@
use crate::{image, quad, text, Image, Primitive, Quad, Transformation};
use crate::{
image, quad, text, Defaults, Image, Primitive, Quad, Transformation,
};
use iced_native::{
renderer::{Debugger, Windowed},
Background, Color, Layout, MouseCursor, Point, Rectangle, Vector, Widget,
@ -411,6 +413,7 @@ impl Renderer {
impl iced_native::Renderer for Renderer {
type Output = (Primitive, MouseCursor);
type Defaults = Defaults;
fn layout<'a, Message>(
&mut self,
@ -445,13 +448,15 @@ impl Windowed for Renderer {
impl Debugger for Renderer {
fn explain<Message>(
&mut self,
defaults: &Defaults,
widget: &dyn Widget<Message, Self>,
layout: Layout<'_>,
cursor_position: Point,
color: Color,
) -> Self::Output {
let mut primitives = Vec::new();
let (primitive, cursor) = widget.draw(self, layout, cursor_position);
let (primitive, cursor) =
widget.draw(self, defaults, layout, cursor_position);
explain_layout(layout, color, &mut primitives);
primitives.push(primitive);

View File

@ -1,21 +1,26 @@
use crate::{button::StyleSheet, Primitive, Renderer};
use iced_native::{Background, MouseCursor, Point, Rectangle};
use crate::{button::StyleSheet, defaults, Defaults, Primitive, Renderer};
use iced_native::{Background, Element, Layout, MouseCursor, Point, Rectangle};
impl iced_native::button::Renderer for Renderer {
type Style = Box<dyn StyleSheet>;
fn draw(
fn draw<Message>(
&mut self,
defaults: &Defaults,
bounds: Rectangle,
cursor_position: Point,
is_disabled: bool,
is_pressed: bool,
style: &Box<dyn StyleSheet>,
(content, _): Self::Output,
content: &Element<'_, Message, Self>,
content_layout: Layout<'_>,
) -> Self::Output {
let is_mouse_over = bounds.contains(cursor_position);
// TODO: Render proper shadows
let styling = if is_mouse_over {
let styling = if is_disabled {
style.disabled()
} else if is_mouse_over {
if is_pressed {
style.pressed()
} else {
@ -25,6 +30,18 @@ impl iced_native::button::Renderer for Renderer {
style.active()
};
let (content, _) = content.draw(
self,
&Defaults {
text: defaults::Text {
color: styling.text_color,
},
..*defaults
},
content_layout,
cursor_position,
);
(
match styling.background {
None => content,

View File

@ -1 +0,0 @@

View File

@ -4,6 +4,7 @@ use iced_native::{column, Element, Layout, MouseCursor, Point};
impl column::Renderer for Renderer {
fn draw<Message>(
&mut self,
defaults: &Self::Defaults,
content: &[Element<'_, Message, Self>],
layout: Layout<'_>,
cursor_position: Point,
@ -17,7 +18,7 @@ impl column::Renderer for Renderer {
.zip(layout.children())
.map(|(child, layout)| {
let (primitive, new_mouse_cursor) =
child.draw(self, layout, cursor_position);
child.draw(self, defaults, layout, cursor_position);
if new_mouse_cursor > mouse_cursor {
mouse_cursor = new_mouse_cursor;

View File

@ -4,6 +4,7 @@ use iced_native::{row, Element, Layout, MouseCursor, Point};
impl row::Renderer for Renderer {
fn draw<Message>(
&mut self,
defaults: &Self::Defaults,
children: &[Element<'_, Message, Self>],
layout: Layout<'_>,
cursor_position: Point,
@ -17,7 +18,7 @@ impl row::Renderer for Renderer {
.zip(layout.children())
.map(|(child, layout)| {
let (primitive, new_mouse_cursor) =
child.draw(self, layout, cursor_position);
child.draw(self, defaults, layout, cursor_position);
if new_mouse_cursor > mouse_cursor {
mouse_cursor = new_mouse_cursor;

View File

@ -27,6 +27,7 @@ impl text::Renderer for Renderer {
fn draw(
&mut self,
defaults: &Self::Defaults,
bounds: Rectangle,
content: &str,
size: u16,
@ -40,7 +41,7 @@ impl text::Renderer for Renderer {
content: content.to_string(),
size: f32::from(size),
bounds,
color: color.unwrap_or(Color::BLACK),
color: color.unwrap_or(defaults.text.color),
font,
horizontal_alignment,
vertical_alignment,

View File

@ -5,7 +5,7 @@
//! [`Button`]: type.Button.html
//! [`State`]: struct.State.html
use crate::Renderer;
use iced_native::Background;
use iced_native::{Background, Color};
pub use iced_native::button::State;
@ -19,6 +19,7 @@ pub struct Style {
pub shadow_offset: f32,
pub background: Option<Background>,
pub border_radius: u16,
pub text_color: Color,
}
pub trait StyleSheet {
@ -41,7 +42,22 @@ pub trait StyleSheet {
}
fn disabled(&self) -> Style {
self.active()
let active = self.active();
Style {
shadow_offset: 0.0,
background: active.background.map(|background| match background {
Background::Color(color) => Background::Color(Color {
a: color.a * 0.5,
..color
}),
}),
text_color: Color {
a: active.text_color.a * 0.5,
..active.text_color
},
..active
}
}
}
@ -53,30 +69,7 @@ impl StyleSheet for Default {
shadow_offset: 1.0,
background: Some(Background::Color([0.5, 0.5, 0.5].into())),
border_radius: 5,
}
}
fn hovered(&self) -> Style {
Style {
shadow_offset: 2.0,
background: Some(Background::Color([0.5, 0.5, 0.5].into())),
border_radius: 5,
}
}
fn pressed(&self) -> Style {
Style {
shadow_offset: 0.0,
background: Some(Background::Color([0.5, 0.5, 0.5].into())),
border_radius: 5,
}
}
fn disabled(&self) -> Style {
Style {
shadow_offset: 0.0,
background: Some(Background::Color([0.7, 0.7, 0.7].into())),
border_radius: 5,
text_color: Color::BLACK,
}
}
}