mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-29 07:16:33 +08:00
Add SkeletonImage
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace AtomUI.Controls;
|
||||
|
||||
public class SkeletonImage : AbstractSkeleton
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<ControlTheme
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
x:Class="AtomUI.Controls.Themes.AbstractSkeletonTheme"
|
||||
TargetType="atom:AbstractSkeleton"
|
||||
x:ClassModifier="internal">
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="atom:AbstractSkeleton">
|
||||
<Panel Name="{x:Static atom:AbstractSkeletonThemeConstants.RootLayoutPart}">
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ActiveAnimationLayerPart}"
|
||||
Background="{TemplateBinding AnimationLayerFill}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsVisible="{TemplateBinding IsActive}"/>
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ContentLayerPart}"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsVisible="{TemplateBinding IsActive, Converter={x:Static BoolConverters.Not}}"/>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:is(atom|AbstractSkeleton)">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.GradientFromColor}}"/>
|
||||
<Setter Property="MotionDuration" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.LoadingMotionDuration}}"/>
|
||||
<Setter Property="LoadingBackgroundStart" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.LoadingBackgroundStart}}"/>
|
||||
<Setter Property="LoadingBackgroundMiddle" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.LoadingBackgroundMiddle}}"/>
|
||||
<Setter Property="LoadingBackgroundEnd" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.LoadingBackgroundEnd}}"/>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
@@ -0,0 +1,7 @@
|
||||
using Avalonia.Styling;
|
||||
|
||||
namespace AtomUI.Controls.Themes;
|
||||
|
||||
internal class AbstractSkeletonTheme : ControlTheme
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<ControlTheme
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:atom="https://atomui.net"
|
||||
x:Class="AtomUI.Controls.Themes.SkeletonImageTheme"
|
||||
TargetType="atom:SkeletonImage"
|
||||
xmlns:themes="using:AtomUI.Controls.Themes"
|
||||
x:ClassModifier="internal">
|
||||
|
||||
<ControlTheme.BasedOn>
|
||||
<themes:AbstractSkeletonTheme TargetType="atom:SkeletonImage" />
|
||||
</ControlTheme.BasedOn>
|
||||
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="atom:AbstractSkeleton">
|
||||
<Panel Name="{x:Static atom:AbstractSkeletonThemeConstants.RootLayoutPart}">
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ActiveAnimationLayerPart}"
|
||||
Background="{TemplateBinding AnimationLayerFill}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsVisible="{TemplateBinding IsActive}" />
|
||||
<Border Name="{x:Static atom:AbstractSkeletonThemeConstants.ContentLayerPart}"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<atom:Icon Name="Image"
|
||||
IconInfo="{atom:IconInfoProvider Kind=ImageFilled}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
NormalFilledBrush="#bfbfbf" />
|
||||
</Border>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^:is(atom|SkeletonImage)">
|
||||
<Setter Property="Height" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.ImageContainerSize}}" />
|
||||
<Setter Property="Width" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.ImageContainerSize}}" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource {x:Static atom:SharedTokenKey.BorderRadiusSM}}" />
|
||||
<Setter Property="MaxWidth" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.ImageContainerMaxSize}}" />
|
||||
<Setter Property="MaxHeight" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.ImageContainerMaxSize}}" />
|
||||
|
||||
<Style Selector="^ /template/ atom|Icon#Image">
|
||||
<Setter Property="Width" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.ImageSize}}" />
|
||||
<Setter Property="Height" Value="{DynamicResource {x:Static atom:SkeletonTokenKey.ImageSize}}" />
|
||||
</Style>
|
||||
</Style>
|
||||
</ControlTheme>
|
||||
@@ -0,0 +1,7 @@
|
||||
using Avalonia.Styling;
|
||||
|
||||
namespace AtomUI.Controls.Themes;
|
||||
|
||||
internal class SkeletonImageTheme : ControlTheme
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 1024 1024">
|
||||
<path d="M365.714286 329.142857q0 45.714286-32.036571 77.677714t-77.677714 32.036571-77.677714-32.036571-32.036571-77.677714 32.036571-77.677714 77.677714-32.036571 77.677714 32.036571 32.036571 77.677714zM950.857143 548.571429l0 256-804.571429 0 0-109.714286 182.857143-182.857143 91.428571 91.428571 292.571429-292.571429zM1005.714286 146.285714l-914.285714 0q-7.460571 0-12.873143 5.412571t-5.412571 12.873143l0 694.857143q0 7.460571 5.412571 12.873143t12.873143 5.412571l914.285714 0q7.460571 0 12.873143-5.412571t5.412571-12.873143l0-694.857143q0-7.460571-5.412571-12.873143t-12.873143-5.412571zM1097.142857 164.571429l0 694.857143q0 37.741714-26.843429 64.585143t-64.585143 26.843429l-914.285714 0q-37.741714 0-64.585143-26.843429t-26.843429-64.585143l0-694.857143q0-37.741714 26.843429-64.585143t64.585143-26.843429l914.285714 0q37.741714 0 64.585143 26.843429t26.843429 64.585143z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1019 B |
+720
-719
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user