settings_re5

This commit is contained in:
lincube
2026-03-14 13:36:18 +08:00
parent 5fdaa2539b
commit e8be0f0576
24 changed files with 993 additions and 321 deletions

View File

@@ -0,0 +1,19 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:fi="using:FluentIcons.Avalonia"
x:Class="LanMountainDesktop.Controls.IconText">
<StackPanel Orientation="Horizontal"
Spacing="8"
VerticalAlignment="Center">
<fi:FluentIcon x:Name="IconElement"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
FontSize="14"
VerticalAlignment="Center" />
<TextBlock x:Name="TextElement"
Foreground="{DynamicResource AdaptiveTextPrimaryBrush}"
FontSize="14"
FontWeight="Medium"
VerticalAlignment="Center" />
</StackPanel>
</UserControl>

View File

@@ -0,0 +1,52 @@
using Avalonia;
using Avalonia.Controls;
using FluentIcons.Avalonia;
using FluentIcons.Common;
namespace LanMountainDesktop.Controls;
public partial class IconText : UserControl
{
public static readonly StyledProperty<Icon> IconProperty =
AvaloniaProperty.Register<IconText, Icon>(nameof(Icon), Icon.Info);
public static readonly StyledProperty<string> TextProperty =
AvaloniaProperty.Register<IconText, string>(nameof(Text), string.Empty);
public IconText()
{
InitializeComponent();
}
public Icon Icon
{
get => GetValue(IconProperty);
set => SetValue(IconProperty, value);
}
public string Text
{
get => GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
base.OnPropertyChanged(change);
if (change.Property == IconProperty)
{
if (IconElement is not null)
{
IconElement.Icon = change.GetNewValue<Icon>();
}
}
else if (change.Property == TextProperty)
{
if (TextElement is not null)
{
TextElement.Text = change.GetNewValue<string?>();
}
}
}
}

View File

@@ -102,6 +102,7 @@ public partial class SettingsOptionCard : UserControl
return iconKey?.Trim() switch
{
"DesignIdeas" => Symbol.Color,
"Image" => Symbol.Image,
"GridDots" => Symbol.GridDots,
"PuzzlePiece" => Symbol.PuzzlePiece,
"Info" => Symbol.Info,

View File

@@ -87,6 +87,7 @@ public partial class SettingsSectionCard : UserControl
return iconKey?.Trim() switch
{
"DesignIdeas" => Symbol.Color,
"Image" => Symbol.Image,
"GridDots" => Symbol.GridDots,
"PuzzlePiece" => Symbol.PuzzlePiece,
"Info" => Symbol.Info,