Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

feat(ui): add Material 3 seekbar, switch, chip and checkbox styles

gtxPrime8156fc62eb86
diff --git a/src/Filee.App/Services/Motion.cs b/src/Filee.App/Services/Motion.cs
index db141a98..c0d4c332 100644
--- a/src/Filee.App/Services/Motion.cs
+++ b/src/Filee.App/Services/Motion.cs
@@ -62,6 +62,9 @@ public static class Motion
Changed?.Invoke(null, EventArgs.Empty);
}
+ /// <summary>Optional callback invoked whenever a window is tracked.</summary>
+ public static Action<Window>? WindowTracked { get; set; }
+
/// <summary>Call once per window so its styles follow the setting.</summary>
public static void Track(Window window)
{
@@ -71,6 +74,19 @@ public static class Motion
Windows.Add(new WeakReference<Window>(window));
}
Apply(window);
+ WindowTracked?.Invoke(window);
+ }
+
+ /// <summary>Executes <paramref name="action"/> on all live tracked windows.</summary>
+ public static void ForEachTracked(Action<Window> action)
+ {
+ lock (Windows)
+ {
+ Windows.RemoveAll(w => !w.TryGetTarget(out _));
+ foreach (var weak in Windows)
+ if (weak.TryGetTarget(out var window))
+ action(window);
+ }
}
private static void Apply(Window window) => window.Classes.Set("reduced-motion", !Enabled);
diff --git a/src/Filee.App/Services/ThemeService.cs b/src/Filee.App/Services/ThemeService.cs
index 0e490cea..aa561ce6 100644
--- a/src/Filee.App/Services/ThemeService.cs
+++ b/src/Filee.App/Services/ThemeService.cs
@@ -12,8 +12,16 @@ using Filee.Core.Settings;
namespace Filee.App.Services;
/// <summary>Runtime theming.</summary>
-public sealed class ThemeService(IPlatformServices platform)
+public sealed class ThemeService
{
+ private readonly IPlatformServices _platform;
+
+ public ThemeService(IPlatformServices platform)
+ {
+ _platform = platform;
+ Motion.WindowTracked = window => window.Classes.Set("material-you", IsMaterialYou);
+ }
+
/// <summary>Accent swatches offered in the Theme page.</summary>
public static readonly IReadOnlyList<string> Swatches =
["#7F77DD", "#1D9E75", "#D85A30", "#378ADD", "#D4537E", "#BA7517", "#639922", "#5F5E5A"];
@@ -118,7 +126,15 @@ public sealed class ThemeService(IPlatformServices platform)
}
}
- Motion.Configure(theme.ReduceMotion, () => platform.PrefersReducedMotion);
+ var isMaterialYou = theme.Style == ThemeStyle.MaterialYou;
+ Motion.ForEachTracked(w => w.Classes.Set("material-you", isMaterialYou));
+ if (app.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktop)
+ {
+ foreach (var window in desktop.Windows)
+ window.Classes.Set("material-you", isMaterialYou);
+ }
+
+ Motion.Configure(theme.ReduceMotion, () => _platform.PrefersReducedMotion);
}
/// <summary>The UI font chain for <paramref name="language"/> (see <see cref="SoftPalette.FontFamilies"/>).</summary>
diff --git a/src/Filee.App/Styles/Soft.axaml b/src/Filee.App/Styles/Soft.axaml
index 95e57986..3a09d162 100644
--- a/src/Filee.App/Styles/Soft.axaml
+++ b/src/Filee.App/Styles/Soft.axaml
@@ -254,11 +254,138 @@
</Style.Animations>
</Style>
+ <!-- ───────── Material You Controls ───────── -->
+
+ <!-- Seekbars / Sliders: Authentic Material 3 rounded pill track & capsule thumb -->
+ <Style Selector="Window.material-you Slider:horizontal">
+ <Setter Property="MinHeight" Value="36" />
+ <Setter Property="Height" Value="36" />
+ <Setter Property="Foreground" Value="{DynamicResource AccentBrush}" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ </Style>
+ <Style Selector="Window.material-you Slider:horizontal /template/ Border#TrackBackground">
+ <Setter Property="Height" Value="16" />
+ <Setter Property="CornerRadius" Value="999" />
+ <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />
+ </Style>
+ <Style Selector="Window.material-you Slider:horizontal /template/ RepeatButton#PART_DecreaseButton">
+ <Setter Property="Background" Value="{DynamicResource AccentBrush}" />
+ <Setter Property="Height" Value="16" />
+ <Setter Property="CornerRadius" Value="999" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ </Style>
+ <Style Selector="Window.material-you Slider:horizontal /template/ RepeatButton#PART_DecreaseButton /template/ Border">
+ <Setter Property="Background" Value="{DynamicResource AccentBrush}" />
+ <Setter Property="Height" Value="16" />
+ <Setter Property="CornerRadius" Value="999" />
+ </Style>
+ <Style Selector="Window.material-you Slider:horizontal /template/ RepeatButton#PART_IncreaseButton">
+ <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />
+ <Setter Property="Height" Value="16" />
+ <Setter Property="CornerRadius" Value="999" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ </Style>
+ <Style Selector="Window.material-you Slider:horizontal /template/ RepeatButton#PART_IncreaseButton /template/ Border">
+ <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />
+ <Setter Property="Height" Value="16" />
+ <Setter Property="CornerRadius" Value="999" />
+ </Style>
+ <Style Selector="Window.material-you Slider:horizontal /template/ Thumb#PART_Thumb">
+ <Setter Property="Width" Value="8" />
+ <Setter Property="Height" Value="28" />
+ <Setter Property="CornerRadius" Value="999" />
+ <Setter Property="Background" Value="{DynamicResource AccentBrush}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource SurfaceBrush}" />
+ <Setter Property="BorderThickness" Value="1.5" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ <Setter Property="Transitions">
+ <Transitions>
+ <TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.18" Easing="{StaticResource SoftEase}" />
+ </Transitions>
+ </Setter>
+ </Style>
+ <Style Selector="Window.material-you Slider:horizontal /template/ Thumb#PART_Thumb:pointerover">
+ <Setter Property="RenderTransform" Value="scale(1.25, 1.08)" />
+ </Style>
+ <Style Selector="Window.material-you Slider:horizontal /template/ Thumb#PART_Thumb:pressed">
+ <Setter Property="RenderTransform" Value="scale(1.4, 1.15)" />
+ </Style>
+
+ <!-- ToggleButtons (Filter chips / Modifier keys) -->
+ <Style Selector="Window.material-you ToggleButton">
+ <Setter Property="CornerRadius" Value="{DynamicResource SoftRadiusSmall}" />
+ <Setter Property="Padding" Value="14,6" />
+ <Setter Property="FontWeight" Value="Medium" />
+ <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource SubtleBorderBrush}" />
+ <Setter Property="BorderThickness" Value="1" />
+ </Style>
+ <Style Selector="Window.material-you ToggleButton:checked /template/ ContentPresenter#PART_ContentPresenter">
+ <Setter Property="Background" Value="{DynamicResource AccentSoftBrush}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
+ <Setter Property="Foreground" Value="{DynamicResource AccentStrongBrush}" />
+ <Setter Property="FontWeight" Value="SemiBold" />
+ </Style>
+ <Style Selector="Window.material-you ToggleButton:checked">
+ <Setter Property="Background" Value="{DynamicResource AccentSoftBrush}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
+ <Setter Property="Foreground" Value="{DynamicResource AccentStrongBrush}" />
+ </Style>
+
+ <!-- ToggleSwitch: M3 track, knob and hover color -->
+ <Style Selector="Window.material-you ToggleSwitch">
+ <Setter Property="Transitions">
+ <Transitions>
+ <TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.18" Easing="{StaticResource SoftEase}" />
+ </Transitions>
+ </Setter>
+ </Style>
+ <Style Selector="Window.material-you ToggleSwitch:pointerover">
+ <Setter Property="RenderTransform" Value="scale(1.02)" />
+ </Style>
+ <Style Selector="Window.material-you ToggleSwitch /template/ Border#SwitchKnobBounds">
+ <Setter Property="CornerRadius" Value="999" />
+ <Setter Property="Transitions">
+ <Transitions>
+ <BrushTransition Property="Background" Duration="0:0:0.18" />
+ <BrushTransition Property="BorderBrush" Duration="0:0:0.18" />
+ </Transitions>
+ </Setter>
+ </Style>
+ <Style Selector="Window.material-you ToggleSwitch:pointerover /template/ Border#SwitchKnobBounds">
+ <Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
+ </Style>
+ <Style Selector="Window.material-you ToggleSwitch:checked /template/ Border#SwitchKnobBounds">
+ <Setter Property="Background" Value="{DynamicResource AccentBrush}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
+ </Style>
+ <Style Selector="Window.material-you ToggleSwitch:checked:pointerover /template/ Border#SwitchKnobBounds">
+ <Setter Property="Background" Value="{DynamicResource AccentStrongBrush}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource AccentStrongBrush}" />
+ </Style>
+ <Style Selector="Window.material-you ToggleSwitch:checked /template/ Ellipse#SwitchKnob">
+ <Setter Property="Fill" Value="{DynamicResource OnAccentBrush}" />
+ </Style>
+
+ <!-- CheckBox: M3 accent states -->
+ <Style Selector="Window.material-you CheckBox /template/ Border#NormalRectangle">
+ <Setter Property="CornerRadius" Value="{DynamicResource SoftRadiusSmall}" />
+ </Style>
+ <Style Selector="Window.material-you CheckBox:checked /template/ Border#NormalRectangle">
+ <Setter Property="Background" Value="{DynamicResource AccentBrush}" />
+ <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
+ </Style>
+ <Style Selector="Window.material-you CheckBox:checked /template/ Path#CheckGlyph">
+ <Setter Property="Fill" Value="{DynamicResource OnAccentBrush}" />
+ <Setter Property="Stroke" Value="{DynamicResource OnAccentBrush}" />
+ </Style>
+
<!-- ───────── Reduced motion: remove every transition and animation above ───────── -->
- <Style Selector="Window.reduced-motion :is(Button), Window.reduced-motion :is(ToggleButton), Window.reduced-motion Border.chip, Window.reduced-motion ListBoxItem">
+ <Style Selector="Window.reduced-motion :is(Button), Window.reduced-motion :is(ToggleButton), Window.reduced-motion Border.chip, Window.reduced-motion ListBoxItem, Window.reduced-motion Slider /template/ Thumb#PART_Thumb">
<Setter Property="Transitions" Value="{x:Null}" />
</Style>
- <Style Selector="Window.reduced-motion Button:pressed, Window.reduced-motion ToggleButton:pressed, Window.reduced-motion Border.chip:pointerover, Window.reduced-motion ListBox.nav ListBoxItem:pointerover">
+ <Style Selector="Window.reduced-motion Button:pressed, Window.reduced-motion ToggleButton:pressed, Window.reduced-motion Border.chip:pointerover, Window.reduced-motion ListBox.nav ListBoxItem:pointerover, Window.reduced-motion Slider /template/ Thumb#PART_Thumb:pointerover">
<Setter Property="RenderTransform" Value="none" />
</Style>
<Style Selector="Window.reduced-motion ContentControl.page > :is(Control), Window.reduced-motion Border.history-card">