mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-22 09:23:53 +08:00
chore(Skeleton): remove SkeletonThemeConstants and inline constants
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using AtomUI.Controls;
|
||||
using AtomUI.Desktop.Controls.Themes;
|
||||
using AtomUI.Theme;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
@@ -194,10 +193,10 @@ public class Skeleton : AbstractSkeleton
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
_avatar = e.NameScope.Find<SkeletonAvatar>(SkeletonThemeConstants.AvatarPart);
|
||||
_title = e.NameScope.Find<SkeletonTitle>(SkeletonThemeConstants.TitlePart);
|
||||
_paragraph = e.NameScope.Find<SkeletonParagraph>(SkeletonThemeConstants.ParagraphPart);
|
||||
|
||||
_avatar = e.NameScope.Find<SkeletonAvatar>("PART_Avatar");
|
||||
_title = e.NameScope.Find<SkeletonTitle>("PART_Title");
|
||||
_paragraph = e.NameScope.Find<SkeletonParagraph>("PART_Paragraph");
|
||||
|
||||
Debug.Assert(_avatar != null);
|
||||
Debug.Assert(_title != null);
|
||||
Debug.Assert(_paragraph != null);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using AtomUI.Desktop.Controls.Themes;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.Primitives;
|
||||
@@ -64,7 +63,7 @@ public class SkeletonLine : AbstractSkeleton
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
_rootLayout = e.NameScope.Find<Panel>(AbstractSkeletonThemeConstants.RootLayoutPart);
|
||||
_rootLayout = e.NameScope.Find<Panel>("PART_RootLayout");
|
||||
if (!IsFollowMode)
|
||||
{
|
||||
if (IsActive)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using AtomUI.Desktop.Controls.Themes;
|
||||
using AtomUI.Theme;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
@@ -79,7 +78,7 @@ public class SkeletonParagraph : AbstractSkeleton
|
||||
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
||||
{
|
||||
base.OnApplyTemplate(e);
|
||||
_linesLayout = e.NameScope.Find<StackPanel>(SkeletonParagraphThemeConstants.LineLayoutPart);
|
||||
_linesLayout = e.NameScope.Find<StackPanel>("PART_LineLayout");
|
||||
BuildLines();
|
||||
if (!IsFollowMode)
|
||||
{
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="atom:AbstractSkeleton">
|
||||
<Panel Name="{x:Static atom:AbstractSkeletonThemeConstants.RootLayoutPart}">
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ActiveAnimationLayerPart}"
|
||||
<Panel Name="PART_RootLayout">
|
||||
<Border Name="PART_ActiveAnimationLayer"
|
||||
Background="{TemplateBinding AnimationLayerFill}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsVisible="{TemplateBinding IsActive}"/>
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ContentLayerPart}"
|
||||
<Border Name="PART_ContentLayer"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsVisible="{TemplateBinding IsActive, Converter={x:Static BoolConverters.Not}}"/>
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="atom:AbstractSkeleton">
|
||||
<Panel Name="{x:Static atom:AbstractSkeletonThemeConstants.RootLayoutPart}">
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ActiveAnimationLayerPart}"
|
||||
<Panel Name="PART_RootLayout">
|
||||
<Border Name="PART_ActiveAnimationLayer"
|
||||
Background="{TemplateBinding AnimationLayerFill}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsVisible="{TemplateBinding IsActive}" />
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ContentLayerPart}"
|
||||
<Border Name="PART_ContentLayer"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<antdicons:ImageFilled Name="Image"
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="atom:SkeletonNode">
|
||||
<Panel Name="{x:Static atom:AbstractSkeletonThemeConstants.RootLayoutPart}">
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ActiveAnimationLayerPart}"
|
||||
<Panel Name="PART_RootLayout">
|
||||
<Border Name="PART_ActiveAnimationLayer"
|
||||
Background="{TemplateBinding AnimationLayerFill}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsVisible="{TemplateBinding IsActive}" />
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ContentLayerPart}"
|
||||
<Border Name="PART_ContentLayer"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ContentPresenter Name="ContentPresenter"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<StackPanel Orientation="Vertical" Name="{x:Static atom:SkeletonParagraphThemeConstants.LineLayoutPart}"/>
|
||||
<StackPanel Orientation="Vertical" Name="PART_LineLayout"/>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
|
||||
@@ -13,20 +13,20 @@
|
||||
<Panel>
|
||||
<DockPanel LastChildFill="True" IsVisible="{TemplateBinding IsContentVisible, Converter={x:Static BoolConverters.Not}}">
|
||||
<atom:SkeletonAvatar DockPanel.Dock="Left"
|
||||
Name="{x:Static atom:SkeletonThemeConstants.AvatarPart}"
|
||||
Name="PART_Avatar"
|
||||
SizeType="{TemplateBinding AvatarSizeType}"
|
||||
Shape="{TemplateBinding AvatarShape}"
|
||||
Size="{TemplateBinding AvatarSize}"
|
||||
IsVisible="{TemplateBinding IsShowAvatar}"
|
||||
IsActive="{TemplateBinding IsActive}"/>
|
||||
<StackPanel Orientation="Vertical"
|
||||
Name="{x:Static atom:SkeletonThemeConstants.ContentPart}">
|
||||
<atom:SkeletonTitle Name="{x:Static atom:SkeletonThemeConstants.TitlePart}"
|
||||
<StackPanel Orientation="Vertical"
|
||||
Name="PART_Content">
|
||||
<atom:SkeletonTitle Name="PART_Title"
|
||||
IsVisible="{TemplateBinding IsShowTitle}"
|
||||
IsRound="{TemplateBinding IsRound}"
|
||||
LineWidth="{TemplateBinding TitleWidth}"
|
||||
IsActive="{TemplateBinding IsActive}"/>
|
||||
<atom:SkeletonParagraph Name="{x:Static atom:SkeletonThemeConstants.ParagraphPart}"
|
||||
<atom:SkeletonParagraph Name="PART_Paragraph"
|
||||
IsVisible="{TemplateBinding IsShowParagraph}"
|
||||
IsRound="{TemplateBinding IsRound}"
|
||||
Rows="{TemplateBinding ParagraphRows}"
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
namespace AtomUI.Desktop.Controls.Themes;
|
||||
|
||||
internal static class AbstractSkeletonThemeConstants
|
||||
{
|
||||
public const string RootLayoutPart = "PART_RootLayout";
|
||||
public const string ActiveAnimationLayerPart = "PART_ActiveAnimationLayer";
|
||||
public const string ContentLayerPart = "PART_ContentLayer";
|
||||
}
|
||||
|
||||
internal static class SkeletonThemeConstants
|
||||
{
|
||||
public const string AvatarPart = "PART_Avatar";
|
||||
public const string TitlePart = "PART_Title";
|
||||
public const string ContentPart = "PART_Content";
|
||||
public const string ParagraphPart = "PART_Paragraph";
|
||||
}
|
||||
|
||||
internal static class SkeletonParagraphThemeConstants
|
||||
{
|
||||
public const string LineLayoutPart = "PART_LineLayout";
|
||||
}
|
||||
Reference in New Issue
Block a user