Color issues
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Windows.Input;
|
||||
using Microsoft.Maui.Graphics;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform;
|
||||
@@ -21,6 +22,14 @@ public class SkiaRefreshView : SkiaLayoutView
|
||||
private float _spinnerRotation = 0f;
|
||||
private DateTime _lastSpinnerUpdate;
|
||||
|
||||
// SKColor fields for rendering
|
||||
private SKColor _refreshColorSK = SkiaTheme.PrimarySK;
|
||||
private SKColor _refreshBackgroundColorSK = SKColors.White;
|
||||
|
||||
// MAUI Color backing fields
|
||||
private Color _refreshColor = Color.FromRgb(33, 150, 243);
|
||||
private Color _refreshBackgroundColor = Colors.White;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the content view.
|
||||
/// </summary>
|
||||
@@ -81,12 +90,30 @@ public class SkiaRefreshView : SkiaLayoutView
|
||||
/// <summary>
|
||||
/// Gets or sets the refresh indicator color.
|
||||
/// </summary>
|
||||
public SKColor RefreshColor { get; set; } = new SKColor(33, 150, 243);
|
||||
public Color RefreshColor
|
||||
{
|
||||
get => _refreshColor;
|
||||
set
|
||||
{
|
||||
_refreshColor = value;
|
||||
_refreshColorSK = value.ToSKColor();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the background color of the refresh indicator.
|
||||
/// </summary>
|
||||
public SKColor RefreshBackgroundColor { get; set; } = SKColors.White;
|
||||
public Color RefreshBackgroundColor
|
||||
{
|
||||
get => _refreshBackgroundColor;
|
||||
set
|
||||
{
|
||||
_refreshBackgroundColor = value;
|
||||
_refreshBackgroundColorSK = value.ToSKColor();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the command to execute when refresh is triggered.
|
||||
@@ -154,19 +181,19 @@ public class SkiaRefreshView : SkiaLayoutView
|
||||
// Draw background circle
|
||||
using var bgPaint = new SKPaint
|
||||
{
|
||||
Color = RefreshBackgroundColor,
|
||||
Color = _refreshBackgroundColorSK,
|
||||
Style = SKPaintStyle.Fill,
|
||||
IsAntialias = true
|
||||
};
|
||||
|
||||
// Add shadow
|
||||
bgPaint.ImageFilter = SKImageFilter.CreateDropShadow(0, 2, 4, 4, new SKColor(0, 0, 0, 40));
|
||||
bgPaint.ImageFilter = SKImageFilter.CreateDropShadow(0, 2, 4, 4, SkiaTheme.Shadow25SK);
|
||||
canvas.DrawCircle(x, y, size / 2, bgPaint);
|
||||
|
||||
// Draw spinner
|
||||
using var spinnerPaint = new SKPaint
|
||||
{
|
||||
Color = RefreshColor,
|
||||
Color = _refreshColorSK,
|
||||
Style = SKPaintStyle.Stroke,
|
||||
StrokeWidth = 3,
|
||||
IsAntialias = true,
|
||||
|
||||
Reference in New Issue
Block a user