fix: icon包

This commit is contained in:
liuyushuai 2024-10-19 21:48:21 +08:00
parent 52904cff8c
commit 06cf9f0443
3 changed files with 22 additions and 24 deletions

View File

@ -1,8 +1,8 @@
using AtomUI.Data;
using AtomUI.Icon;
using AtomUI.IconPkg;
using AtomUI.IconPkg.AntDesign;
using AtomUI.Theme.Data;
using AtomUI.Theme.Styling;
using AtomUI.Utils;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
@ -31,8 +31,8 @@ public class Timeline : ItemsControl
public static readonly StyledProperty<bool> ReverseProperty =
AvaloniaProperty.Register<Timeline, bool>(nameof(Reverse), false);
public static readonly StyledProperty<PathIcon?> PendingIconProperty =
AvaloniaProperty.Register<Alert, PathIcon?>(nameof(PendingIcon));
public static readonly StyledProperty<Icon?> PendingIconProperty =
AvaloniaProperty.Register<Alert, Icon?>(nameof(PendingIcon));
public TimeLineMode Mode
{
@ -52,7 +52,7 @@ public class Timeline : ItemsControl
set { SetValue(ReverseProperty, value); }
}
public PathIcon? PendingIcon
public Icon? PendingIcon
{
get => GetValue(PendingIconProperty);
set => SetValue(PendingIconProperty, value);
@ -144,15 +144,12 @@ public class Timeline : ItemsControl
if (PendingIcon is null)
{
PendingIcon = new PathIcon
{
Kind = "LoadingOutlined",
Width = 10,
Height = 10,
LoadingAnimation = IconAnimation.Spin,
VerticalAlignment = VerticalAlignment.Top,
HorizontalAlignment = HorizontalAlignment.Center,
};
PendingIcon = AntDesignIconPackage.LoadingOutlined();
PendingIcon.Width = 10;
PendingIcon.Height = 10;
PendingIcon.LoadingAnimation = IconAnimation.Spin;
PendingIcon.VerticalAlignment = VerticalAlignment.Top;
PendingIcon.HorizontalAlignment = HorizontalAlignment.Center;
}
_pendingItem.DotIcon = PendingIcon;

View File

@ -1,5 +1,6 @@
using AtomUI.IconPkg;
using AtomUI.Theme.Styling;
using AtomUI.Utils;
using AtomUI.Theme.Data;
using Avalonia;
using Avalonia.Collections;
using Avalonia.Controls;
@ -22,8 +23,8 @@ public class TimelineItem : ContentControl
public static readonly StyledProperty<string?> LabelProperty =
AvaloniaProperty.Register<TimelineItem, string?>(nameof(Label));
public static readonly StyledProperty<PathIcon?> DotIconProperty =
AvaloniaProperty.Register<Alert, PathIcon?>(nameof(DotIcon));
public static readonly StyledProperty<Icon?> DotIconProperty =
AvaloniaProperty.Register<Alert, Icon?>(nameof(DotIcon));
public static readonly StyledProperty<string> ColorProperty =
AvaloniaProperty.Register<TimelineItem, string>(nameof(Color), "blue");
@ -34,7 +35,7 @@ public class TimelineItem : ContentControl
set => SetValue(LabelProperty, value);
}
public PathIcon? DotIcon
public Icon? DotIcon
{
get => GetValue(DotIconProperty);
set => SetValue(DotIconProperty, value);
@ -143,7 +144,7 @@ public class TimelineItem : ContentControl
private TextBlock? _labelBlock;
private ContentPresenter? _itemsContentPresenter;
private Border? _splitHeadPart;
private PathIcon? _dotPart;
private Icon? _dotPart;
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
@ -169,7 +170,7 @@ public class TimelineItem : ContentControl
_labelBlock = scope.Find<TextBlock>(TimelineItemTheme.LabelPart);
_itemsContentPresenter = scope.Find<ContentPresenter>(TimelineItemTheme.ItemsContentPresenterPart);
_splitHeadPart = scope.Find<Border>(TimelineItemTheme.SplitHeadPart);
_dotPart = scope.Find<PathIcon>(TimelineItemTheme.DotPart);
_dotPart = scope.Find<Icon>(TimelineItemTheme.DotPart);
UpdateAll();
}
@ -316,7 +317,7 @@ public class TimelineItem : ContentControl
{
if (_dotPart is not null && _dotPart.NormalFilledBrush is null)
{
TokenResourceBinder.CreateGlobalTokenBinding(_dotPart, PathIcon.NormalFilledBrushProperty,
TokenResourceBinder.CreateGlobalTokenBinding(_dotPart, Icon.NormalFilledBrushProperty,
GlobalTokenResourceKey.ColorPrimary);
}
@ -347,7 +348,7 @@ public class TimelineItem : ContentControl
}
if (_dotPart is not null && _dotPart.NormalFilledBrush is null)
{
TokenResourceBinder.CreateGlobalTokenBinding(_dotPart, PathIcon.NormalFilledBrushProperty,
TokenResourceBinder.CreateGlobalTokenBinding(_dotPart, Icon.NormalFilledBrushProperty,
tokenText);
}

View File

@ -1,4 +1,4 @@
using AtomUI.Theme.TokenSystem;
using AtomUI.Theme.TokenSystem;
namespace AtomUI.Theme.Styling
{