Adjust AutoScroll default styling in scrollable

This commit is contained in:
Héctor Ramón Jiménez 2025-11-28 22:02:17 +01:00
parent c21289df4a
commit e9f1ac2c2a
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -36,8 +36,8 @@ use crate::core::widget::tree::{self, Tree};
use crate::core::window; use crate::core::window;
use crate::core::{ use crate::core::{
self, Background, Clipboard, Color, Element, Event, InputMethod, Layout, self, Background, Clipboard, Color, Element, Event, InputMethod, Layout,
Length, Padding, Pixels, Point, Rectangle, Shell, Size, Theme, Vector, Length, Padding, Pixels, Point, Rectangle, Shadow, Shell, Size, Theme,
Widget, Vector, Widget,
}; };
pub use operation::scrollable::{AbsoluteOffset, RelativeOffset}; pub use operation::scrollable::{AbsoluteOffset, RelativeOffset};
@ -1455,11 +1455,7 @@ where
renderer::Quad { renderer::Quad {
bounds, bounds,
border: style.border, border: style.border,
shadow: core::Shadow { shadow: style.shadow,
color: Color::BLACK.scale_alpha(0.8),
offset: Vector::new(1.0, 1.0),
blur_radius: 3.0,
},
snap: false, snap: false,
}, },
style.background, style.background,
@ -1498,10 +1494,7 @@ where
align_y: alignment::Vertical::Top, align_y: alignment::Vertical::Top,
..arrow ..arrow
}, },
Point::new( Point::new(bounds.center_x(), bounds.y + Self::PADDING),
bounds.center_x(),
bounds.y + Self::PADDING - 1.0,
),
style.icon, style.icon,
bounds, bounds,
); );
@ -1514,7 +1507,7 @@ where
}, },
Point::new( Point::new(
bounds.center_x(), bounds.center_x(),
bounds.y + bounds.height - Self::PADDING + 1.0, bounds.y + bounds.height - Self::PADDING - 0.5,
), ),
style.icon, style.icon,
bounds, bounds,
@ -1529,7 +1522,7 @@ where
..arrow ..arrow
}, },
Point::new( Point::new(
bounds.x + Self::PADDING, bounds.x + Self::PADDING + 1.0,
bounds.center_y() + 1.0, bounds.center_y() + 1.0,
), ),
style.icon, style.icon,
@ -1543,7 +1536,7 @@ where
..arrow ..arrow
}, },
Point::new( Point::new(
bounds.x + bounds.width - Self::PADDING, bounds.x + bounds.width - Self::PADDING - 1.0,
bounds.center_y() + 1.0, bounds.center_y() + 1.0,
), ),
style.icon, style.icon,
@ -2304,6 +2297,8 @@ pub struct AutoScroll {
pub background: Background, pub background: Background,
/// The [`Border`] of the [`AutoScroll`] overlay. /// The [`Border`] of the [`AutoScroll`] overlay.
pub border: Border, pub border: Border,
/// Thje [`Shadow`] of the [`AutoScroll`] overlay.
pub shadow: Shadow,
/// The [`Color`] for the arrow icons of the [`AutoScroll`] overlay. /// The [`Color`] for the arrow icons of the [`AutoScroll`] overlay.
pub icon: Color, pub icon: Color,
} }
@ -2349,11 +2344,16 @@ pub fn default(theme: &Theme, status: Status) -> Style {
}; };
let auto_scroll = AutoScroll { let auto_scroll = AutoScroll {
background: palette.background.weak.color.scale_alpha(0.9).into(), background: palette.background.base.color.scale_alpha(0.9).into(),
border: border::rounded(u32::MAX) border: border::rounded(u32::MAX)
.width(1) .width(1)
.color(palette.background.weak.text.scale_alpha(0.8)), .color(palette.background.base.text.scale_alpha(0.8)),
icon: palette.background.weak.text.scale_alpha(0.8), shadow: Shadow {
color: Color::BLACK.scale_alpha(0.7),
offset: Vector::ZERO,
blur_radius: 2.0,
},
icon: palette.background.base.text.scale_alpha(0.8),
}; };
match status { match status {