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

View File

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

View File

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