From cc906c83cdf896d94b7ccf91258466714be631f6 Mon Sep 17 00:00:00 2001
From: Nick Senger <dev@nsenger.com>
Date: Wed, 8 Nov 2023 19:12:53 -0800
Subject: feat: quad shadows

---
 widget/src/button.rs          | 2 ++
 widget/src/checkbox.rs        | 1 +
 widget/src/container.rs       | 1 +
 widget/src/overlay/menu.rs    | 2 ++
 widget/src/pane_grid.rs       | 3 +++
 widget/src/pick_list.rs       | 1 +
 widget/src/progress_bar.rs    | 2 ++
 widget/src/radio.rs           | 2 ++
 widget/src/rule.rs            | 1 +
 widget/src/scrollable.rs      | 2 ++
 widget/src/slider.rs          | 3 +++
 widget/src/text_editor.rs     | 3 +++
 widget/src/text_input.rs      | 3 +++
 widget/src/toggler.rs         | 2 ++
 widget/src/vertical_slider.rs | 3 +++
 15 files changed, 31 insertions(+)

(limited to 'widget')

diff --git a/widget/src/button.rs b/widget/src/button.rs
index 0ebb8dcc..44628a6a 100644
--- a/widget/src/button.rs
+++ b/widget/src/button.rs
@@ -404,6 +404,7 @@ where
                     border_radius: styling.border_radius,
                     border_width: 0.0,
                     border_color: Color::TRANSPARENT,
+                    shadow: Default::default(),
                 },
                 Background::Color([0.0, 0.0, 0.0, 0.5].into()),
             );
@@ -415,6 +416,7 @@ where
                 border_radius: styling.border_radius,
                 border_width: styling.border_width,
                 border_color: styling.border_color,
+                shadow: Default::default(),
             },
             styling
                 .background
diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs
index 0353b3ad..5cc79b08 100644
--- a/widget/src/checkbox.rs
+++ b/widget/src/checkbox.rs
@@ -287,6 +287,7 @@ where
                     border_radius: custom_style.border_radius,
                     border_width: custom_style.border_width,
                     border_color: custom_style.border_color,
+                    shadow: Default::default(),
                 },
                 custom_style.background,
             );
diff --git a/widget/src/container.rs b/widget/src/container.rs
index cffb0458..519d4f15 100644
--- a/widget/src/container.rs
+++ b/widget/src/container.rs
@@ -344,6 +344,7 @@ pub fn draw_background<Renderer>(
                 border_radius: appearance.border_radius,
                 border_width: appearance.border_width,
                 border_color: appearance.border_color,
+                shadow: Default::default(),
             },
             appearance
                 .background
diff --git a/widget/src/overlay/menu.rs b/widget/src/overlay/menu.rs
index f83eebea..03935e59 100644
--- a/widget/src/overlay/menu.rs
+++ b/widget/src/overlay/menu.rs
@@ -309,6 +309,7 @@ where
                 border_color: appearance.border_color,
                 border_width: appearance.border_width,
                 border_radius: appearance.border_radius,
+                shadow: Default::default(),
             },
             appearance.background,
         );
@@ -519,6 +520,7 @@ where
                         border_color: Color::TRANSPARENT,
                         border_width: 0.0,
                         border_radius: appearance.border_radius,
+                        shadow: Default::default(),
                     },
                     appearance.selected_background,
                 );
diff --git a/widget/src/pane_grid.rs b/widget/src/pane_grid.rs
index cf1f0455..fc30716d 100644
--- a/widget/src/pane_grid.rs
+++ b/widget/src/pane_grid.rs
@@ -921,6 +921,7 @@ pub fn draw<Renderer, T>(
                                     .border_radius,
                                 border_width: hovered_region_style.border_width,
                                 border_color: hovered_region_style.border_color,
+                                shadow: Default::default(),
                             },
                             theme.hovered_region(style).background,
                         );
@@ -950,6 +951,7 @@ pub fn draw<Renderer, T>(
                 border_radius: hovered_region_style.border_radius,
                 border_width: hovered_region_style.border_width,
                 border_color: hovered_region_style.border_color,
+                shadow: Default::default(),
             },
             theme.hovered_region(style).background,
         );
@@ -1013,6 +1015,7 @@ pub fn draw<Renderer, T>(
                         border_radius: 0.0.into(),
                         border_width: 0.0,
                         border_color: Color::TRANSPARENT,
+                        shadow: Default::default(),
                     },
                     highlight.color,
                 );
diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs
index 2e3aab6f..8931aa99 100644
--- a/widget/src/pick_list.rs
+++ b/widget/src/pick_list.rs
@@ -656,6 +656,7 @@ pub fn draw<'a, T, Renderer>(
             border_color: style.border_color,
             border_width: style.border_width,
             border_radius: style.border_radius,
+            shadow: Default::default(),
         },
         style.background,
     );
diff --git a/widget/src/progress_bar.rs b/widget/src/progress_bar.rs
index 15f1277b..1e0f2a82 100644
--- a/widget/src/progress_bar.rs
+++ b/widget/src/progress_bar.rs
@@ -133,6 +133,7 @@ where
                 border_radius: style.border_radius,
                 border_width: 0.0,
                 border_color: Color::TRANSPARENT,
+                shadow: Default::default(),
             },
             style.background,
         );
@@ -147,6 +148,7 @@ where
                     border_radius: style.border_radius,
                     border_width: 0.0,
                     border_color: Color::TRANSPARENT,
+                    shadow: Default::default(),
                 },
                 style.bar,
             );
diff --git a/widget/src/radio.rs b/widget/src/radio.rs
index f91b20b1..0a33825f 100644
--- a/widget/src/radio.rs
+++ b/widget/src/radio.rs
@@ -315,6 +315,7 @@ where
                     border_radius: (size / 2.0).into(),
                     border_width: custom_style.border_width,
                     border_color: custom_style.border_color,
+                    shadow: Default::default(),
                 },
                 custom_style.background,
             );
@@ -331,6 +332,7 @@ where
                         border_radius: (dot_size / 2.0).into(),
                         border_width: 0.0,
                         border_color: Color::TRANSPARENT,
+                        shadow: Default::default(),
                     },
                     custom_style.dot_color,
                 );
diff --git a/widget/src/rule.rs b/widget/src/rule.rs
index cded9cb1..4a83e9d1 100644
--- a/widget/src/rule.rs
+++ b/widget/src/rule.rs
@@ -127,6 +127,7 @@ where
                 border_radius: style.radius,
                 border_width: 0.0,
                 border_color: Color::TRANSPARENT,
+                shadow: Default::default(),
             },
             style.color,
         );
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index 70db490a..82602a41 100644
--- a/widget/src/scrollable.rs
+++ b/widget/src/scrollable.rs
@@ -912,6 +912,7 @@ pub fn draw<Renderer>(
                             border_radius: style.border_radius,
                             border_width: style.border_width,
                             border_color: style.border_color,
+                            shadow: Default::default(),
                         },
                         style
                             .background
@@ -932,6 +933,7 @@ pub fn draw<Renderer>(
                             border_radius: style.scroller.border_radius,
                             border_width: style.scroller.border_width,
                             border_color: style.scroller.border_color,
+                            shadow: Default::default(),
                         },
                         style.scroller.color,
                     );
diff --git a/widget/src/slider.rs b/widget/src/slider.rs
index 1bc94661..d89f50e0 100644
--- a/widget/src/slider.rs
+++ b/widget/src/slider.rs
@@ -401,6 +401,7 @@ pub fn draw<T, R>(
             border_radius: style.rail.border_radius,
             border_width: 0.0,
             border_color: Color::TRANSPARENT,
+            shadow: Default::default(),
         },
         style.rail.colors.0,
     );
@@ -416,6 +417,7 @@ pub fn draw<T, R>(
             border_radius: style.rail.border_radius,
             border_width: 0.0,
             border_color: Color::TRANSPARENT,
+            shadow: Default::default(),
         },
         style.rail.colors.1,
     );
@@ -431,6 +433,7 @@ pub fn draw<T, R>(
             border_radius: handle_border_radius,
             border_width: style.handle.border_width,
             border_color: style.handle.border_color,
+            shadow: Default::default(),
         },
         style.handle.color,
     );
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs
index 09a0cac0..3f3ccf72 100644
--- a/widget/src/text_editor.rs
+++ b/widget/src/text_editor.rs
@@ -470,6 +470,7 @@ where
                 border_radius: appearance.border_radius,
                 border_width: appearance.border_width,
                 border_color: appearance.border_color,
+                shadow: Default::default(),
             },
             appearance.background,
         );
@@ -511,6 +512,7 @@ where
                                 border_radius: 0.0.into(),
                                 border_width: 0.0,
                                 border_color: Color::TRANSPARENT,
+                                shadow: Default::default(),
                             },
                             theme.value_color(&self.style),
                         );
@@ -526,6 +528,7 @@ where
                                 border_radius: 0.0.into(),
                                 border_width: 0.0,
                                 border_color: Color::TRANSPARENT,
+                                shadow: Default::default(),
                             },
                             theme.selection_color(&self.style),
                         );
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs
index c3dce8be..f8e6c7f8 100644
--- a/widget/src/text_input.rs
+++ b/widget/src/text_input.rs
@@ -1085,6 +1085,7 @@ pub fn draw<Renderer>(
             border_radius: appearance.border_radius,
             border_width: appearance.border_width,
             border_color: appearance.border_color,
+            shadow: Default::default(),
         },
         appearance.background,
     );
@@ -1134,6 +1135,7 @@ pub fn draw<Renderer>(
                             border_radius: 0.0.into(),
                             border_width: 0.0,
                             border_color: Color::TRANSPARENT,
+                            shadow: Default::default(),
                         },
                         theme.value_color(style),
                     ))
@@ -1175,6 +1177,7 @@ pub fn draw<Renderer>(
                             border_radius: 0.0.into(),
                             border_width: 0.0,
                             border_color: Color::TRANSPARENT,
+                            shadow: Default::default(),
                         },
                         theme.selection_color(style),
                     )),
diff --git a/widget/src/toggler.rs b/widget/src/toggler.rs
index 941159ea..f7fb5d58 100644
--- a/widget/src/toggler.rs
+++ b/widget/src/toggler.rs
@@ -317,6 +317,7 @@ where
                 border_color: style
                     .background_border
                     .unwrap_or(style.background),
+                shadow: Default::default(),
             },
             style.background,
         );
@@ -341,6 +342,7 @@ where
                 border_color: style
                     .foreground_border
                     .unwrap_or(style.foreground),
+                shadow: Default::default(),
             },
             style.foreground,
         );
diff --git a/widget/src/vertical_slider.rs b/widget/src/vertical_slider.rs
index a3029d76..4fdad861 100644
--- a/widget/src/vertical_slider.rs
+++ b/widget/src/vertical_slider.rs
@@ -400,6 +400,7 @@ pub fn draw<T, R>(
             border_radius: style.rail.border_radius,
             border_width: 0.0,
             border_color: Color::TRANSPARENT,
+            shadow: Default::default(),
         },
         style.rail.colors.1,
     );
@@ -415,6 +416,7 @@ pub fn draw<T, R>(
             border_radius: style.rail.border_radius,
             border_width: 0.0,
             border_color: Color::TRANSPARENT,
+            shadow: Default::default(),
         },
         style.rail.colors.0,
     );
@@ -430,6 +432,7 @@ pub fn draw<T, R>(
             border_radius: handle_border_radius,
             border_width: style.handle.border_width,
             border_color: style.handle.border_color,
+            shadow: Default::default(),
         },
         style.handle.color,
     );
-- 
cgit 


From 370b2f6df799c948188d3949e34112258b2a8498 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Sat, 20 Jan 2024 12:25:07 +0100
Subject: Use `Default` implementation of `renderer::Quad`

---
 widget/src/button.rs          |  6 ++----
 widget/src/checkbox.rs        |  2 +-
 widget/src/container.rs       |  2 +-
 widget/src/overlay/menu.rs    |  8 +++-----
 widget/src/pane_grid.rs       | 13 +++++--------
 widget/src/pick_list.rs       |  2 +-
 widget/src/progress_bar.rs    | 10 +++-------
 widget/src/radio.rs           |  9 +++------
 widget/src/rule.rs            |  8 ++------
 widget/src/scrollable.rs      |  4 ++--
 widget/src/slider.rs          | 14 +++++---------
 widget/src/text_editor.rs     | 15 ++++-----------
 widget/src/text_input.rs      | 16 +++++-----------
 widget/src/toggler.rs         |  4 ++--
 widget/src/vertical_slider.rs | 13 ++++---------
 15 files changed, 43 insertions(+), 83 deletions(-)

(limited to 'widget')

diff --git a/widget/src/button.rs b/widget/src/button.rs
index 44628a6a..f9e59f23 100644
--- a/widget/src/button.rs
+++ b/widget/src/button.rs
@@ -402,9 +402,7 @@ where
                         ..bounds
                     },
                     border_radius: styling.border_radius,
-                    border_width: 0.0,
-                    border_color: Color::TRANSPARENT,
-                    shadow: Default::default(),
+                    ..renderer::Quad::default()
                 },
                 Background::Color([0.0, 0.0, 0.0, 0.5].into()),
             );
@@ -416,7 +414,7 @@ where
                 border_radius: styling.border_radius,
                 border_width: styling.border_width,
                 border_color: styling.border_color,
-                shadow: Default::default(),
+                ..renderer::Quad::default()
             },
             styling
                 .background
diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs
index 5cc79b08..80397c13 100644
--- a/widget/src/checkbox.rs
+++ b/widget/src/checkbox.rs
@@ -287,7 +287,7 @@ where
                     border_radius: custom_style.border_radius,
                     border_width: custom_style.border_width,
                     border_color: custom_style.border_color,
-                    shadow: Default::default(),
+                    ..renderer::Quad::default()
                 },
                 custom_style.background,
             );
diff --git a/widget/src/container.rs b/widget/src/container.rs
index 519d4f15..b3d2f360 100644
--- a/widget/src/container.rs
+++ b/widget/src/container.rs
@@ -344,7 +344,7 @@ pub fn draw_background<Renderer>(
                 border_radius: appearance.border_radius,
                 border_width: appearance.border_width,
                 border_color: appearance.border_color,
-                shadow: Default::default(),
+                ..renderer::Quad::default()
             },
             appearance
                 .background
diff --git a/widget/src/overlay/menu.rs b/widget/src/overlay/menu.rs
index 03935e59..2086e993 100644
--- a/widget/src/overlay/menu.rs
+++ b/widget/src/overlay/menu.rs
@@ -10,7 +10,7 @@ use crate::core::text::{self, Text};
 use crate::core::touch;
 use crate::core::widget::Tree;
 use crate::core::{
-    Clipboard, Color, Length, Padding, Pixels, Point, Rectangle, Size, Vector,
+    Clipboard, Length, Padding, Pixels, Point, Rectangle, Size, Vector,
 };
 use crate::core::{Element, Shell, Widget};
 use crate::scrollable::{self, Scrollable};
@@ -309,7 +309,7 @@ where
                 border_color: appearance.border_color,
                 border_width: appearance.border_width,
                 border_radius: appearance.border_radius,
-                shadow: Default::default(),
+                ..renderer::Quad::default()
             },
             appearance.background,
         );
@@ -517,10 +517,8 @@ where
                             width: bounds.width - appearance.border_width * 2.0,
                             ..bounds
                         },
-                        border_color: Color::TRANSPARENT,
-                        border_width: 0.0,
                         border_radius: appearance.border_radius,
-                        shadow: Default::default(),
+                        ..renderer::Quad::default()
                     },
                     appearance.selected_background,
                 );
diff --git a/widget/src/pane_grid.rs b/widget/src/pane_grid.rs
index fc30716d..38ae17f0 100644
--- a/widget/src/pane_grid.rs
+++ b/widget/src/pane_grid.rs
@@ -42,8 +42,8 @@ use crate::core::touch;
 use crate::core::widget;
 use crate::core::widget::tree::{self, Tree};
 use crate::core::{
-    Clipboard, Color, Element, Layout, Length, Pixels, Point, Rectangle, Shell,
-    Size, Vector, Widget,
+    Clipboard, Element, Layout, Length, Pixels, Point, Rectangle, Shell, Size,
+    Vector, Widget,
 };
 
 /// A collection of panes distributed using either vertical or horizontal splits
@@ -921,7 +921,7 @@ pub fn draw<Renderer, T>(
                                     .border_radius,
                                 border_width: hovered_region_style.border_width,
                                 border_color: hovered_region_style.border_color,
-                                shadow: Default::default(),
+                                ..renderer::Quad::default()
                             },
                             theme.hovered_region(style).background,
                         );
@@ -951,7 +951,7 @@ pub fn draw<Renderer, T>(
                 border_radius: hovered_region_style.border_radius,
                 border_width: hovered_region_style.border_width,
                 border_color: hovered_region_style.border_color,
-                shadow: Default::default(),
+                ..renderer::Quad::default()
             },
             theme.hovered_region(style).background,
         );
@@ -1012,10 +1012,7 @@ pub fn draw<Renderer, T>(
                                 height: split_region.height,
                             },
                         },
-                        border_radius: 0.0.into(),
-                        border_width: 0.0,
-                        border_color: Color::TRANSPARENT,
-                        shadow: Default::default(),
+                        ..renderer::Quad::default()
                     },
                     highlight.color,
                 );
diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs
index 8931aa99..ef0c0eb3 100644
--- a/widget/src/pick_list.rs
+++ b/widget/src/pick_list.rs
@@ -656,7 +656,7 @@ pub fn draw<'a, T, Renderer>(
             border_color: style.border_color,
             border_width: style.border_width,
             border_radius: style.border_radius,
-            shadow: Default::default(),
+            ..renderer::Quad::default()
         },
         style.background,
     );
diff --git a/widget/src/progress_bar.rs b/widget/src/progress_bar.rs
index 1e0f2a82..1d48ff73 100644
--- a/widget/src/progress_bar.rs
+++ b/widget/src/progress_bar.rs
@@ -3,7 +3,7 @@ use crate::core::layout;
 use crate::core::mouse;
 use crate::core::renderer;
 use crate::core::widget::Tree;
-use crate::core::{Color, Element, Layout, Length, Rectangle, Size, Widget};
+use crate::core::{Element, Layout, Length, Rectangle, Size, Widget};
 
 use std::ops::RangeInclusive;
 
@@ -131,9 +131,7 @@ where
             renderer::Quad {
                 bounds: Rectangle { ..bounds },
                 border_radius: style.border_radius,
-                border_width: 0.0,
-                border_color: Color::TRANSPARENT,
-                shadow: Default::default(),
+                ..renderer::Quad::default()
             },
             style.background,
         );
@@ -146,9 +144,7 @@ where
                         ..bounds
                     },
                     border_radius: style.border_radius,
-                    border_width: 0.0,
-                    border_color: Color::TRANSPARENT,
-                    shadow: Default::default(),
+                    ..renderer::Quad::default()
                 },
                 style.bar,
             );
diff --git a/widget/src/radio.rs b/widget/src/radio.rs
index 0a33825f..a782812e 100644
--- a/widget/src/radio.rs
+++ b/widget/src/radio.rs
@@ -9,8 +9,7 @@ use crate::core::touch;
 use crate::core::widget;
 use crate::core::widget::tree::{self, Tree};
 use crate::core::{
-    Clipboard, Color, Element, Layout, Length, Pixels, Rectangle, Shell, Size,
-    Widget,
+    Clipboard, Element, Layout, Length, Pixels, Rectangle, Shell, Size, Widget,
 };
 
 pub use iced_style::radio::{Appearance, StyleSheet};
@@ -315,7 +314,7 @@ where
                     border_radius: (size / 2.0).into(),
                     border_width: custom_style.border_width,
                     border_color: custom_style.border_color,
-                    shadow: Default::default(),
+                    ..renderer::Quad::default()
                 },
                 custom_style.background,
             );
@@ -330,9 +329,7 @@ where
                             height: bounds.height - dot_size,
                         },
                         border_radius: (dot_size / 2.0).into(),
-                        border_width: 0.0,
-                        border_color: Color::TRANSPARENT,
-                        shadow: Default::default(),
+                        ..renderer::Quad::default()
                     },
                     custom_style.dot_color,
                 );
diff --git a/widget/src/rule.rs b/widget/src/rule.rs
index 4a83e9d1..813b0e46 100644
--- a/widget/src/rule.rs
+++ b/widget/src/rule.rs
@@ -3,9 +3,7 @@ use crate::core::layout;
 use crate::core::mouse;
 use crate::core::renderer;
 use crate::core::widget::Tree;
-use crate::core::{
-    Color, Element, Layout, Length, Pixels, Rectangle, Size, Widget,
-};
+use crate::core::{Element, Layout, Length, Pixels, Rectangle, Size, Widget};
 
 pub use crate::style::rule::{Appearance, FillMode, StyleSheet};
 
@@ -125,9 +123,7 @@ where
             renderer::Quad {
                 bounds,
                 border_radius: style.radius,
-                border_width: 0.0,
-                border_color: Color::TRANSPARENT,
-                shadow: Default::default(),
+                ..renderer::Quad::default()
             },
             style.color,
         );
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index 82602a41..beaad704 100644
--- a/widget/src/scrollable.rs
+++ b/widget/src/scrollable.rs
@@ -912,7 +912,7 @@ pub fn draw<Renderer>(
                             border_radius: style.border_radius,
                             border_width: style.border_width,
                             border_color: style.border_color,
-                            shadow: Default::default(),
+                            ..renderer::Quad::default()
                         },
                         style
                             .background
@@ -933,7 +933,7 @@ pub fn draw<Renderer>(
                             border_radius: style.scroller.border_radius,
                             border_width: style.scroller.border_width,
                             border_color: style.scroller.border_color,
-                            shadow: Default::default(),
+                            ..renderer::Quad::default()
                         },
                         style.scroller.color,
                     );
diff --git a/widget/src/slider.rs b/widget/src/slider.rs
index d89f50e0..d12e0ebe 100644
--- a/widget/src/slider.rs
+++ b/widget/src/slider.rs
@@ -8,8 +8,8 @@ use crate::core::renderer;
 use crate::core::touch;
 use crate::core::widget::tree::{self, Tree};
 use crate::core::{
-    Clipboard, Color, Element, Layout, Length, Pixels, Point, Rectangle, Shell,
-    Size, Widget,
+    Clipboard, Element, Layout, Length, Pixels, Point, Rectangle, Shell, Size,
+    Widget,
 };
 
 use std::ops::RangeInclusive;
@@ -399,9 +399,7 @@ pub fn draw<T, R>(
                 height: style.rail.width,
             },
             border_radius: style.rail.border_radius,
-            border_width: 0.0,
-            border_color: Color::TRANSPARENT,
-            shadow: Default::default(),
+            ..renderer::Quad::default()
         },
         style.rail.colors.0,
     );
@@ -415,9 +413,7 @@ pub fn draw<T, R>(
                 height: style.rail.width,
             },
             border_radius: style.rail.border_radius,
-            border_width: 0.0,
-            border_color: Color::TRANSPARENT,
-            shadow: Default::default(),
+            ..renderer::Quad::default()
         },
         style.rail.colors.1,
     );
@@ -433,7 +429,7 @@ pub fn draw<T, R>(
             border_radius: handle_border_radius,
             border_width: style.handle.border_width,
             border_color: style.handle.border_color,
-            shadow: Default::default(),
+            ..renderer::Quad::default()
         },
         style.handle.color,
     );
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs
index 3f3ccf72..01ab1262 100644
--- a/widget/src/text_editor.rs
+++ b/widget/src/text_editor.rs
@@ -10,8 +10,7 @@ use crate::core::text::highlighter::{self, Highlighter};
 use crate::core::text::{self, LineHeight};
 use crate::core::widget::{self, Widget};
 use crate::core::{
-    Clipboard, Color, Element, Length, Padding, Pixels, Rectangle, Shell, Size,
-    Vector,
+    Clipboard, Element, Length, Padding, Pixels, Rectangle, Shell, Size, Vector,
 };
 
 use std::cell::RefCell;
@@ -470,7 +469,7 @@ where
                 border_radius: appearance.border_radius,
                 border_width: appearance.border_width,
                 border_color: appearance.border_color,
-                shadow: Default::default(),
+                ..renderer::Quad::default()
             },
             appearance.background,
         );
@@ -509,10 +508,7 @@ where
                                         )
                                         .into(),
                                 },
-                                border_radius: 0.0.into(),
-                                border_width: 0.0,
-                                border_color: Color::TRANSPARENT,
-                                shadow: Default::default(),
+                                ..renderer::Quad::default()
                             },
                             theme.value_color(&self.style),
                         );
@@ -525,10 +521,7 @@ where
                         renderer.fill_quad(
                             renderer::Quad {
                                 bounds: range,
-                                border_radius: 0.0.into(),
-                                border_width: 0.0,
-                                border_color: Color::TRANSPARENT,
-                                shadow: Default::default(),
+                                ..renderer::Quad::default()
                             },
                             theme.selection_color(&self.style),
                         );
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs
index f8e6c7f8..7b15f58c 100644
--- a/widget/src/text_input.rs
+++ b/widget/src/text_input.rs
@@ -26,8 +26,8 @@ use crate::core::widget::operation::{self, Operation};
 use crate::core::widget::tree::{self, Tree};
 use crate::core::window;
 use crate::core::{
-    Clipboard, Color, Element, Layout, Length, Padding, Pixels, Point,
-    Rectangle, Shell, Size, Vector, Widget,
+    Clipboard, Element, Layout, Length, Padding, Pixels, Point, Rectangle,
+    Shell, Size, Vector, Widget,
 };
 use crate::runtime::Command;
 
@@ -1085,7 +1085,7 @@ pub fn draw<Renderer>(
             border_radius: appearance.border_radius,
             border_width: appearance.border_width,
             border_color: appearance.border_color,
-            shadow: Default::default(),
+            ..renderer::Quad::default()
         },
         appearance.background,
     );
@@ -1132,10 +1132,7 @@ pub fn draw<Renderer>(
                                 width: 1.0,
                                 height: text_bounds.height,
                             },
-                            border_radius: 0.0.into(),
-                            border_width: 0.0,
-                            border_color: Color::TRANSPARENT,
-                            shadow: Default::default(),
+                            ..renderer::Quad::default()
                         },
                         theme.value_color(style),
                     ))
@@ -1174,10 +1171,7 @@ pub fn draw<Renderer>(
                                 width,
                                 height: text_bounds.height,
                             },
-                            border_radius: 0.0.into(),
-                            border_width: 0.0,
-                            border_color: Color::TRANSPARENT,
-                            shadow: Default::default(),
+                            ..renderer::Quad::default()
                         },
                         theme.selection_color(style),
                     )),
diff --git a/widget/src/toggler.rs b/widget/src/toggler.rs
index f7fb5d58..0bafffe1 100644
--- a/widget/src/toggler.rs
+++ b/widget/src/toggler.rs
@@ -317,7 +317,7 @@ where
                 border_color: style
                     .background_border
                     .unwrap_or(style.background),
-                shadow: Default::default(),
+                ..renderer::Quad::default()
             },
             style.background,
         );
@@ -342,7 +342,7 @@ where
                 border_color: style
                     .foreground_border
                     .unwrap_or(style.foreground),
-                shadow: Default::default(),
+                ..renderer::Quad::default()
             },
             style.foreground,
         );
diff --git a/widget/src/vertical_slider.rs b/widget/src/vertical_slider.rs
index 4fdad861..7a461b08 100644
--- a/widget/src/vertical_slider.rs
+++ b/widget/src/vertical_slider.rs
@@ -13,8 +13,7 @@ use crate::core::renderer;
 use crate::core::touch;
 use crate::core::widget::tree::{self, Tree};
 use crate::core::{
-    Clipboard, Color, Element, Length, Pixels, Point, Rectangle, Shell, Size,
-    Widget,
+    Clipboard, Element, Length, Pixels, Point, Rectangle, Shell, Size, Widget,
 };
 
 /// An vertical bar and a handle that selects a single value from a range of
@@ -398,9 +397,7 @@ pub fn draw<T, R>(
                 height: offset + handle_width / 2.0,
             },
             border_radius: style.rail.border_radius,
-            border_width: 0.0,
-            border_color: Color::TRANSPARENT,
-            shadow: Default::default(),
+            ..renderer::Quad::default()
         },
         style.rail.colors.1,
     );
@@ -414,9 +411,7 @@ pub fn draw<T, R>(
                 height: bounds.height - offset - handle_width / 2.0,
             },
             border_radius: style.rail.border_radius,
-            border_width: 0.0,
-            border_color: Color::TRANSPARENT,
-            shadow: Default::default(),
+            ..renderer::Quad::default()
         },
         style.rail.colors.0,
     );
@@ -432,7 +427,7 @@ pub fn draw<T, R>(
             border_radius: handle_border_radius,
             border_width: style.handle.border_width,
             border_color: style.handle.border_color,
-            shadow: Default::default(),
+            ..renderer::Quad::default()
         },
         style.handle.color,
     );
-- 
cgit 


From 25f182f933ea6b7c112c8f9a450a98dc9b9eebdd Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Sat, 20 Jan 2024 13:29:25 +0100
Subject: Introduce `Border` struct analogous to `Shadow`

---
 widget/src/button.rs          | 24 +++---------------------
 widget/src/checkbox.rs        |  4 +---
 widget/src/container.rs       |  6 ++----
 widget/src/overlay/menu.rs    | 12 +++++-------
 widget/src/pane_grid.rs       |  9 ++-------
 widget/src/pick_list.rs       |  4 +---
 widget/src/progress_bar.rs    |  6 +++---
 widget/src/radio.rs           | 13 ++++++++-----
 widget/src/rule.rs            |  6 ++++--
 widget/src/scrollable.rs      | 16 ++++++----------
 widget/src/slider.rs          | 16 +++++++++-------
 widget/src/text_editor.rs     |  4 +---
 widget/src/text_input.rs      |  4 +---
 widget/src/toggler.rs         | 24 ++++++++++++------------
 widget/src/vertical_slider.rs | 15 +++++++++------
 15 files changed, 67 insertions(+), 96 deletions(-)

(limited to 'widget')

diff --git a/widget/src/button.rs b/widget/src/button.rs
index f9e59f23..f052ebab 100644
--- a/widget/src/button.rs
+++ b/widget/src/button.rs
@@ -11,7 +11,7 @@ use crate::core::widget::tree::{self, Tree};
 use crate::core::widget::Operation;
 use crate::core::{
     Background, Clipboard, Color, Element, Layout, Length, Padding, Rectangle,
-    Shell, Size, Vector, Widget,
+    Shell, Size, Widget,
 };
 
 pub use iced_style::button::{Appearance, StyleSheet};
@@ -391,29 +391,11 @@ where
         style_sheet.active(style)
     };
 
-    if styling.background.is_some() || styling.border_width > 0.0 {
-        if styling.shadow_offset != Vector::default() {
-            // TODO: Implement proper shadow support
-            renderer.fill_quad(
-                renderer::Quad {
-                    bounds: Rectangle {
-                        x: bounds.x + styling.shadow_offset.x,
-                        y: bounds.y + styling.shadow_offset.y,
-                        ..bounds
-                    },
-                    border_radius: styling.border_radius,
-                    ..renderer::Quad::default()
-                },
-                Background::Color([0.0, 0.0, 0.0, 0.5].into()),
-            );
-        }
-
+    if styling.background.is_some() || styling.border.width > 0.0 {
         renderer.fill_quad(
             renderer::Quad {
                 bounds,
-                border_radius: styling.border_radius,
-                border_width: styling.border_width,
-                border_color: styling.border_color,
+                border: styling.border,
                 ..renderer::Quad::default()
             },
             styling
diff --git a/widget/src/checkbox.rs b/widget/src/checkbox.rs
index 80397c13..76268314 100644
--- a/widget/src/checkbox.rs
+++ b/widget/src/checkbox.rs
@@ -284,9 +284,7 @@ where
             renderer.fill_quad(
                 renderer::Quad {
                     bounds,
-                    border_radius: custom_style.border_radius,
-                    border_width: custom_style.border_width,
-                    border_color: custom_style.border_color,
+                    border: custom_style.border,
                     ..renderer::Quad::default()
                 },
                 custom_style.background,
diff --git a/widget/src/container.rs b/widget/src/container.rs
index b3d2f360..b87f1d9f 100644
--- a/widget/src/container.rs
+++ b/widget/src/container.rs
@@ -337,13 +337,11 @@ pub fn draw_background<Renderer>(
 ) where
     Renderer: crate::core::Renderer,
 {
-    if appearance.background.is_some() || appearance.border_width > 0.0 {
+    if appearance.background.is_some() || appearance.border.width > 0.0 {
         renderer.fill_quad(
             renderer::Quad {
                 bounds,
-                border_radius: appearance.border_radius,
-                border_width: appearance.border_width,
-                border_color: appearance.border_color,
+                border: appearance.border,
                 ..renderer::Quad::default()
             },
             appearance
diff --git a/widget/src/overlay/menu.rs b/widget/src/overlay/menu.rs
index 2086e993..678bb7b5 100644
--- a/widget/src/overlay/menu.rs
+++ b/widget/src/overlay/menu.rs
@@ -10,7 +10,7 @@ use crate::core::text::{self, Text};
 use crate::core::touch;
 use crate::core::widget::Tree;
 use crate::core::{
-    Clipboard, Length, Padding, Pixels, Point, Rectangle, Size, Vector,
+    Border, Clipboard, Length, Padding, Pixels, Point, Rectangle, Size, Vector,
 };
 use crate::core::{Element, Shell, Widget};
 use crate::scrollable::{self, Scrollable};
@@ -306,9 +306,7 @@ where
         renderer.fill_quad(
             renderer::Quad {
                 bounds,
-                border_color: appearance.border_color,
-                border_width: appearance.border_width,
-                border_radius: appearance.border_radius,
+                border: appearance.border,
                 ..renderer::Quad::default()
             },
             appearance.background,
@@ -513,11 +511,11 @@ where
                 renderer.fill_quad(
                     renderer::Quad {
                         bounds: Rectangle {
-                            x: bounds.x + appearance.border_width,
-                            width: bounds.width - appearance.border_width * 2.0,
+                            x: bounds.x + appearance.border.width,
+                            width: bounds.width - appearance.border.width * 2.0,
                             ..bounds
                         },
-                        border_radius: appearance.border_radius,
+                        border: Border::with_radius(appearance.border.radius),
                         ..renderer::Quad::default()
                     },
                     appearance.selected_background,
diff --git a/widget/src/pane_grid.rs b/widget/src/pane_grid.rs
index 38ae17f0..3fda0e32 100644
--- a/widget/src/pane_grid.rs
+++ b/widget/src/pane_grid.rs
@@ -917,10 +917,7 @@ pub fn draw<Renderer, T>(
                         renderer.fill_quad(
                             renderer::Quad {
                                 bounds,
-                                border_radius: hovered_region_style
-                                    .border_radius,
-                                border_width: hovered_region_style.border_width,
-                                border_color: hovered_region_style.border_color,
+                                border: hovered_region_style.border,
                                 ..renderer::Quad::default()
                             },
                             theme.hovered_region(style).background,
@@ -948,9 +945,7 @@ pub fn draw<Renderer, T>(
         renderer.fill_quad(
             renderer::Quad {
                 bounds,
-                border_radius: hovered_region_style.border_radius,
-                border_width: hovered_region_style.border_width,
-                border_color: hovered_region_style.border_color,
+                border: hovered_region_style.border,
                 ..renderer::Quad::default()
             },
             theme.hovered_region(style).background,
diff --git a/widget/src/pick_list.rs b/widget/src/pick_list.rs
index ef0c0eb3..4d4e14d3 100644
--- a/widget/src/pick_list.rs
+++ b/widget/src/pick_list.rs
@@ -653,9 +653,7 @@ pub fn draw<'a, T, Renderer>(
     renderer.fill_quad(
         renderer::Quad {
             bounds,
-            border_color: style.border_color,
-            border_width: style.border_width,
-            border_radius: style.border_radius,
+            border: style.border,
             ..renderer::Quad::default()
         },
         style.background,
diff --git a/widget/src/progress_bar.rs b/widget/src/progress_bar.rs
index 1d48ff73..eb15644e 100644
--- a/widget/src/progress_bar.rs
+++ b/widget/src/progress_bar.rs
@@ -3,7 +3,7 @@ use crate::core::layout;
 use crate::core::mouse;
 use crate::core::renderer;
 use crate::core::widget::Tree;
-use crate::core::{Element, Layout, Length, Rectangle, Size, Widget};
+use crate::core::{Border, Element, Layout, Length, Rectangle, Size, Widget};
 
 use std::ops::RangeInclusive;
 
@@ -130,7 +130,7 @@ where
         renderer.fill_quad(
             renderer::Quad {
                 bounds: Rectangle { ..bounds },
-                border_radius: style.border_radius,
+                border: Border::with_radius(style.border_radius),
                 ..renderer::Quad::default()
             },
             style.background,
@@ -143,7 +143,7 @@ where
                         width: active_progress_width,
                         ..bounds
                     },
-                    border_radius: style.border_radius,
+                    border: Border::with_radius(style.border_radius),
                     ..renderer::Quad::default()
                 },
                 style.bar,
diff --git a/widget/src/radio.rs b/widget/src/radio.rs
index a782812e..ceb51ead 100644
--- a/widget/src/radio.rs
+++ b/widget/src/radio.rs
@@ -9,7 +9,8 @@ use crate::core::touch;
 use crate::core::widget;
 use crate::core::widget::tree::{self, Tree};
 use crate::core::{
-    Clipboard, Element, Layout, Length, Pixels, Rectangle, Shell, Size, Widget,
+    Border, Clipboard, Element, Layout, Length, Pixels, Rectangle, Shell, Size,
+    Widget,
 };
 
 pub use iced_style::radio::{Appearance, StyleSheet};
@@ -311,9 +312,11 @@ where
             renderer.fill_quad(
                 renderer::Quad {
                     bounds,
-                    border_radius: (size / 2.0).into(),
-                    border_width: custom_style.border_width,
-                    border_color: custom_style.border_color,
+                    border: Border {
+                        radius: (size / 2.0).into(),
+                        width: custom_style.border_width,
+                        color: custom_style.border_color,
+                    },
                     ..renderer::Quad::default()
                 },
                 custom_style.background,
@@ -328,7 +331,7 @@ where
                             width: bounds.width - dot_size,
                             height: bounds.height - dot_size,
                         },
-                        border_radius: (dot_size / 2.0).into(),
+                        border: Border::with_radius(dot_size / 2.0),
                         ..renderer::Quad::default()
                     },
                     custom_style.dot_color,
diff --git a/widget/src/rule.rs b/widget/src/rule.rs
index 813b0e46..c958c44d 100644
--- a/widget/src/rule.rs
+++ b/widget/src/rule.rs
@@ -3,7 +3,9 @@ use crate::core::layout;
 use crate::core::mouse;
 use crate::core::renderer;
 use crate::core::widget::Tree;
-use crate::core::{Element, Layout, Length, Pixels, Rectangle, Size, Widget};
+use crate::core::{
+    Border, Element, Layout, Length, Pixels, Rectangle, Size, Widget,
+};
 
 pub use crate::style::rule::{Appearance, FillMode, StyleSheet};
 
@@ -122,7 +124,7 @@ where
         renderer.fill_quad(
             renderer::Quad {
                 bounds,
-                border_radius: style.radius,
+                border: Border::with_radius(style.radius),
                 ..renderer::Quad::default()
             },
             style.color,
diff --git a/widget/src/scrollable.rs b/widget/src/scrollable.rs
index beaad704..b7b6c3d2 100644
--- a/widget/src/scrollable.rs
+++ b/widget/src/scrollable.rs
@@ -903,15 +903,13 @@ pub fn draw<Renderer>(
                 if scrollbar.bounds.width > 0.0
                     && scrollbar.bounds.height > 0.0
                     && (style.background.is_some()
-                        || (style.border_color != Color::TRANSPARENT
-                            && style.border_width > 0.0))
+                        || (style.border.color != Color::TRANSPARENT
+                            && style.border.width > 0.0))
                 {
                     renderer.fill_quad(
                         renderer::Quad {
                             bounds: scrollbar.bounds,
-                            border_radius: style.border_radius,
-                            border_width: style.border_width,
-                            border_color: style.border_color,
+                            border: style.border,
                             ..renderer::Quad::default()
                         },
                         style
@@ -924,15 +922,13 @@ pub fn draw<Renderer>(
                 if scrollbar.scroller.bounds.width > 0.0
                     && scrollbar.scroller.bounds.height > 0.0
                     && (style.scroller.color != Color::TRANSPARENT
-                        || (style.scroller.border_color != Color::TRANSPARENT
-                            && style.scroller.border_width > 0.0))
+                        || (style.scroller.border.color != Color::TRANSPARENT
+                            && style.scroller.border.width > 0.0))
                 {
                     renderer.fill_quad(
                         renderer::Quad {
                             bounds: scrollbar.scroller.bounds,
-                            border_radius: style.scroller.border_radius,
-                            border_width: style.scroller.border_width,
-                            border_color: style.scroller.border_color,
+                            border: style.scroller.border,
                             ..renderer::Quad::default()
                         },
                         style.scroller.color,
diff --git a/widget/src/slider.rs b/widget/src/slider.rs
index d12e0ebe..79b0a7d8 100644
--- a/widget/src/slider.rs
+++ b/widget/src/slider.rs
@@ -8,8 +8,8 @@ use crate::core::renderer;
 use crate::core::touch;
 use crate::core::widget::tree::{self, Tree};
 use crate::core::{
-    Clipboard, Element, Layout, Length, Pixels, Point, Rectangle, Shell, Size,
-    Widget,
+    Border, Clipboard, Element, Layout, Length, Pixels, Point, Rectangle,
+    Shell, Size, Widget,
 };
 
 use std::ops::RangeInclusive;
@@ -398,7 +398,7 @@ pub fn draw<T, R>(
                 width: offset + handle_width / 2.0,
                 height: style.rail.width,
             },
-            border_radius: style.rail.border_radius,
+            border: Border::with_radius(style.rail.border_radius),
             ..renderer::Quad::default()
         },
         style.rail.colors.0,
@@ -412,7 +412,7 @@ pub fn draw<T, R>(
                 width: bounds.width - offset - handle_width / 2.0,
                 height: style.rail.width,
             },
-            border_radius: style.rail.border_radius,
+            border: Border::with_radius(style.rail.border_radius),
             ..renderer::Quad::default()
         },
         style.rail.colors.1,
@@ -426,9 +426,11 @@ pub fn draw<T, R>(
                 width: handle_width,
                 height: handle_height,
             },
-            border_radius: handle_border_radius,
-            border_width: style.handle.border_width,
-            border_color: style.handle.border_color,
+            border: Border {
+                radius: handle_border_radius,
+                width: style.handle.border_width,
+                color: style.handle.border_color,
+            },
             ..renderer::Quad::default()
         },
         style.handle.color,
diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs
index 01ab1262..6b716238 100644
--- a/widget/src/text_editor.rs
+++ b/widget/src/text_editor.rs
@@ -466,9 +466,7 @@ where
         renderer.fill_quad(
             renderer::Quad {
                 bounds,
-                border_radius: appearance.border_radius,
-                border_width: appearance.border_width,
-                border_color: appearance.border_color,
+                border: appearance.border,
                 ..renderer::Quad::default()
             },
             appearance.background,
diff --git a/widget/src/text_input.rs b/widget/src/text_input.rs
index 7b15f58c..02715989 100644
--- a/widget/src/text_input.rs
+++ b/widget/src/text_input.rs
@@ -1082,9 +1082,7 @@ pub fn draw<Renderer>(
     renderer.fill_quad(
         renderer::Quad {
             bounds,
-            border_radius: appearance.border_radius,
-            border_width: appearance.border_width,
-            border_color: appearance.border_color,
+            border: appearance.border,
             ..renderer::Quad::default()
         },
         appearance.background,
diff --git a/widget/src/toggler.rs b/widget/src/toggler.rs
index 0bafffe1..58cd38ab 100644
--- a/widget/src/toggler.rs
+++ b/widget/src/toggler.rs
@@ -9,8 +9,8 @@ use crate::core::touch;
 use crate::core::widget;
 use crate::core::widget::tree::{self, Tree};
 use crate::core::{
-    Clipboard, Element, Event, Layout, Length, Pixels, Rectangle, Shell, Size,
-    Widget,
+    Border, Clipboard, Element, Event, Layout, Length, Pixels, Rectangle,
+    Shell, Size, Widget,
 };
 
 pub use crate::style::toggler::{Appearance, StyleSheet};
@@ -312,11 +312,11 @@ where
         renderer.fill_quad(
             renderer::Quad {
                 bounds: toggler_background_bounds,
-                border_radius: border_radius.into(),
-                border_width: 1.0,
-                border_color: style
-                    .background_border
-                    .unwrap_or(style.background),
+                border: Border {
+                    radius: border_radius.into(),
+                    width: 1.0,
+                    color: style.background_border.unwrap_or(style.background),
+                },
                 ..renderer::Quad::default()
             },
             style.background,
@@ -337,11 +337,11 @@ where
         renderer.fill_quad(
             renderer::Quad {
                 bounds: toggler_foreground_bounds,
-                border_radius: border_radius.into(),
-                border_width: 1.0,
-                border_color: style
-                    .foreground_border
-                    .unwrap_or(style.foreground),
+                border: Border {
+                    radius: border_radius.into(),
+                    width: 1.0,
+                    color: style.foreground_border.unwrap_or(style.foreground),
+                },
                 ..renderer::Quad::default()
             },
             style.foreground,
diff --git a/widget/src/vertical_slider.rs b/widget/src/vertical_slider.rs
index 7a461b08..52428c10 100644
--- a/widget/src/vertical_slider.rs
+++ b/widget/src/vertical_slider.rs
@@ -13,7 +13,8 @@ use crate::core::renderer;
 use crate::core::touch;
 use crate::core::widget::tree::{self, Tree};
 use crate::core::{
-    Clipboard, Element, Length, Pixels, Point, Rectangle, Shell, Size, Widget,
+    Border, Clipboard, Element, Length, Pixels, Point, Rectangle, Shell, Size,
+    Widget,
 };
 
 /// An vertical bar and a handle that selects a single value from a range of
@@ -396,7 +397,7 @@ pub fn draw<T, R>(
                 width: style.rail.width,
                 height: offset + handle_width / 2.0,
             },
-            border_radius: style.rail.border_radius,
+            border: Border::with_radius(style.rail.border_radius),
             ..renderer::Quad::default()
         },
         style.rail.colors.1,
@@ -410,7 +411,7 @@ pub fn draw<T, R>(
                 width: style.rail.width,
                 height: bounds.height - offset - handle_width / 2.0,
             },
-            border_radius: style.rail.border_radius,
+            border: Border::with_radius(style.rail.border_radius),
             ..renderer::Quad::default()
         },
         style.rail.colors.0,
@@ -424,9 +425,11 @@ pub fn draw<T, R>(
                 width: handle_height,
                 height: handle_width,
             },
-            border_radius: handle_border_radius,
-            border_width: style.handle.border_width,
-            border_color: style.handle.border_color,
+            border: Border {
+                radius: handle_border_radius,
+                width: style.handle.border_width,
+                color: style.handle.border_color,
+            },
             ..renderer::Quad::default()
         },
         style.handle.color,
-- 
cgit 


From e736038d5ff9adb9c011326879d4c772338d12d9 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Sat, 20 Jan 2024 13:32:19 +0100
Subject: Add `Shadow` to `button::Appearance`

---
 widget/src/button.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'widget')

diff --git a/widget/src/button.rs b/widget/src/button.rs
index f052ebab..cd141169 100644
--- a/widget/src/button.rs
+++ b/widget/src/button.rs
@@ -391,11 +391,15 @@ where
         style_sheet.active(style)
     };
 
-    if styling.background.is_some() || styling.border.width > 0.0 {
+    if styling.background.is_some()
+        || styling.shadow.color.a > 0.0
+        || styling.border.width > 0.0
+    {
         renderer.fill_quad(
             renderer::Quad {
                 bounds,
                 border: styling.border,
+                shadow: styling.shadow,
                 ..renderer::Quad::default()
             },
             styling
-- 
cgit 


From bf375587aa52808cdabf4191571f20784315ea99 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Sat, 20 Jan 2024 13:34:07 +0100
Subject: Add `Shadow` to `container::Appearance`

---
 widget/src/button.rs    | 3 +--
 widget/src/container.rs | 7 +++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

(limited to 'widget')

diff --git a/widget/src/button.rs b/widget/src/button.rs
index cd141169..14626dd3 100644
--- a/widget/src/button.rs
+++ b/widget/src/button.rs
@@ -392,15 +392,14 @@ where
     };
 
     if styling.background.is_some()
-        || styling.shadow.color.a > 0.0
         || styling.border.width > 0.0
+        || styling.shadow.color.a > 0.0
     {
         renderer.fill_quad(
             renderer::Quad {
                 bounds,
                 border: styling.border,
                 shadow: styling.shadow,
-                ..renderer::Quad::default()
             },
             styling
                 .background
diff --git a/widget/src/container.rs b/widget/src/container.rs
index b87f1d9f..f2d1aaba 100644
--- a/widget/src/container.rs
+++ b/widget/src/container.rs
@@ -337,12 +337,15 @@ pub fn draw_background<Renderer>(
 ) where
     Renderer: crate::core::Renderer,
 {
-    if appearance.background.is_some() || appearance.border.width > 0.0 {
+    if appearance.background.is_some()
+        || appearance.border.width > 0.0
+        || appearance.shadow.color.a > 0.0
+    {
         renderer.fill_quad(
             renderer::Quad {
                 bounds,
                 border: appearance.border,
-                ..renderer::Quad::default()
+                shadow: appearance.shadow,
             },
             appearance
                 .background
-- 
cgit