container: generalise background from Color to Paint
`Container::background` now stores `Option<Paint>` instead of `Option<Color>`, and the builder accepts `impl Into<Paint>` so callers can pass a plain `Color` (auto-wrapped in `Paint::Solid` via the trait impl) or an explicit `LinearGradient` / `RadialGradient`. `layout_and_draw` switches from `canvas.fill_rect( rect, bg, corners )` to `canvas.fill_paint_rect( rect, &bg, corners )` to consume the wider type. No behaviour change for existing call sites — solid-colour containers keep working unchanged thanks to the `Into<Paint>` for `Color`.
This commit is contained in:
@@ -164,9 +164,9 @@ pub( crate ) fn layout_and_draw<Msg: Clone>(
|
||||
};
|
||||
if !painted
|
||||
{
|
||||
if let Some( bg ) = c.background
|
||||
if let Some( ref bg ) = c.background
|
||||
{
|
||||
canvas.fill_rect( rect, bg, c.corners );
|
||||
canvas.fill_paint_rect( rect, bg, c.corners );
|
||||
}
|
||||
}
|
||||
if let Some( ( color, width ) ) = c.border
|
||||
|
||||
Reference in New Issue
Block a user