Skip to content

Commit fd0b395

Browse files
authored
Avalonia Port: Refactor, macOS Fixes, and UI Improvements (#4529)
* Added sidebar expand/collapse * Fixed some bug in AbstractPackagesPage * make changes to the app style * refactor some code to be more like avalonia * Fixed untranslated strings in pages * refactor - commands, bindings, and view cleanup
1 parent 66d1935 commit fd0b395

78 files changed

Lines changed: 1759 additions & 1385 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/UniGetUI.Avalonia/App.axaml

Lines changed: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -2,102 +2,14 @@
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
x:Class="UniGetUI.Avalonia.App"
44
xmlns:avaloniaApplication1="clr-namespace:UniGetUI.Avalonia"
5-
xmlns:controls="using:UniGetUI.Avalonia.Views.Controls"
65
RequestedThemeVariant="Default">
76

87
<Application.DataTemplates>
98
<avaloniaApplication1:ViewLocator/>
109
</Application.DataTemplates>
1110

12-
<Application.Resources>
13-
<ResourceDictionary>
14-
<ResourceDictionary.ThemeDictionaries>
15-
<ResourceDictionary x:Key="Dark">
16-
<!-- Settings cards -->
17-
<SolidColorBrush x:Key="SettingsCardBackground" Color="#262B3C"/>
18-
<SolidColorBrush x:Key="SettingsCardBorderBrush" Color="#3a3a3a"/>
19-
<SolidColorBrush x:Key="SettingsCardHoverBackground" Color="#2e3448"/>
20-
<!-- Window structure -->
21-
<SolidColorBrush x:Key="AppWindowBackground" Color="#1e2025"/>
22-
<SolidColorBrush x:Key="AppTitleBarBackground" Color="#313131"/>
23-
<SolidColorBrush x:Key="AppSplitterBackground" Color="#14161a"/>
24-
<SolidColorBrush x:Key="AppOperationsPanelBackground" Color="#16181c"/>
25-
<SolidColorBrush x:Key="AppBorderBrush" Color="#323439"/>
26-
<SolidColorBrush x:Key="AppBadgeBackground" Color="#3c3e44"/>
27-
<!-- Dialogs -->
28-
<SolidColorBrush x:Key="AppDialogBackground" Color="#1e2025"/>
29-
<SolidColorBrush x:Key="AppDialogPanelBackground" Color="#2a2d34"/>
30-
<SolidColorBrush x:Key="AppDialogSubtleBackground" Color="#3a3d44"/>
31-
<SolidColorBrush x:Key="AppDialogDarkBackground" Color="#12141a"/>
32-
<!-- Warning banner -->
33-
<SolidColorBrush x:Key="WarningBannerBackground" Color="#3d2800"/>
34-
<SolidColorBrush x:Key="WarningBannerBorderBrush" Color="#7a5200"/>
35-
<SolidColorBrush x:Key="WarningBannerIconBackground" Color="#f0a500"/>
36-
<SolidColorBrush x:Key="WarningBannerIconForeground" Color="#1a1000"/>
37-
<SolidColorBrush x:Key="WarningBannerSubtext" Color="#ffe082"/>
38-
<!-- Setting warning subtext (WarningText on cards) -->
39-
<SolidColorBrush x:Key="SettingWarningTextForeground" Color="#ffc107"/>
40-
</ResourceDictionary>
41-
<ResourceDictionary x:Key="Light">
42-
<!-- Settings cards -->
43-
<SolidColorBrush x:Key="SettingsCardBackground" Color="#f3f3f3"/>
44-
<SolidColorBrush x:Key="SettingsCardBorderBrush" Color="#d0d0d0"/>
45-
<SolidColorBrush x:Key="SettingsCardHoverBackground" Color="#e8e8e8"/>
46-
<!-- Window structure -->
47-
<SolidColorBrush x:Key="AppWindowBackground" Color="#f0f0f0"/>
48-
<SolidColorBrush x:Key="AppTitleBarBackground" Color="#e0e0e0"/>
49-
<SolidColorBrush x:Key="AppSplitterBackground" Color="#d8d8d8"/>
50-
<SolidColorBrush x:Key="AppOperationsPanelBackground" Color="#f8f8f8"/>
51-
<SolidColorBrush x:Key="AppBorderBrush" Color="#cccccc"/>
52-
<SolidColorBrush x:Key="AppBadgeBackground" Color="#e0e0e0"/>
53-
<!-- Dialogs -->
54-
<SolidColorBrush x:Key="AppDialogBackground" Color="#ffffff"/>
55-
<SolidColorBrush x:Key="AppDialogPanelBackground" Color="#f5f5f5"/>
56-
<SolidColorBrush x:Key="AppDialogSubtleBackground" Color="#ebebeb"/>
57-
<SolidColorBrush x:Key="AppDialogDarkBackground" Color="#e8e8e8"/>
58-
<!-- Warning banner -->
59-
<SolidColorBrush x:Key="WarningBannerBackground" Color="#fff8e1"/>
60-
<SolidColorBrush x:Key="WarningBannerBorderBrush" Color="#d4a700"/>
61-
<SolidColorBrush x:Key="WarningBannerIconBackground" Color="#f0a500"/>
62-
<SolidColorBrush x:Key="WarningBannerIconForeground" Color="#1a1000"/>
63-
<SolidColorBrush x:Key="WarningBannerSubtext" Color="#7a4f00"/>
64-
<!-- Setting warning subtext (WarningText on cards) -->
65-
<SolidColorBrush x:Key="SettingWarningTextForeground" Color="#a05c00"/>
66-
</ResourceDictionary>
67-
</ResourceDictionary.ThemeDictionaries>
68-
</ResourceDictionary>
69-
</Application.Resources>
70-
7111
<Application.Styles>
7212
<FluentTheme />
73-
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
74-
75-
<!-- SettingsCard appearance -->
76-
<Style Selector="Border.settings-card">
77-
<Setter Property="Background" Value="{DynamicResource SettingsCardBackground}"/>
78-
<Setter Property="BorderBrush" Value="{DynamicResource SettingsCardBorderBrush}"/>
79-
<Setter Property="Margin" Value="40,0"/>
80-
</Style>
81-
<Style Selector="Border.settings-card-clickable:pointerover">
82-
<Setter Property="Background" Value="{DynamicResource SettingsCardHoverBackground}"/>
83-
</Style>
84-
85-
<!-- Setting warning subtext (amber, both themes) -->
86-
<Style Selector="TextBlock.setting-warning-text">
87-
<Setter Property="Foreground" Value="{DynamicResource SettingWarningTextForeground}"/>
88-
</Style>
89-
90-
<!-- Warning banner (InfoBar-style amber/golden) -->
91-
<Style Selector="Border.warning-banner">
92-
<Setter Property="Background" Value="{DynamicResource WarningBannerBackground}"/>
93-
<Setter Property="BorderBrush" Value="{DynamicResource WarningBannerBorderBrush}"/>
94-
<Setter Property="BorderThickness" Value="1"/>
95-
<Setter Property="Margin" Value="40,4,40,0"/>
96-
</Style>
97-
98-
<!-- SvgIcon: inherit the Fluent foreground so icons match text colour in both themes -->
99-
<Style Selector="controls|SvgIcon">
100-
<Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
101-
</Style>
13+
<StyleInclude Source="avares://UniGetUI.Avalonia/Assets/Styles/Styles.Common.axaml"/>
10214
</Application.Styles>
10315
</Application>

src/UniGetUI.Avalonia/App.axaml.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Avalonia.Controls.ApplicationLifetimes;
44
using Avalonia.Data.Core.Plugins;
55
using Avalonia.Markup.Xaml;
6+
using Avalonia.Markup.Xaml.Styling;
67
using Avalonia.Styling;
78
using UniGetUI.Avalonia.Views;
89
using UniGetUI.PackageEngine;
@@ -15,6 +16,15 @@ public partial class App : Application
1516
public override void Initialize()
1617
{
1718
AvaloniaXamlLoader.Load(this);
19+
20+
string platform = OperatingSystem.IsWindows() ? "Windows"
21+
: OperatingSystem.IsMacOS() ? "macOS"
22+
: "Linux";
23+
24+
Styles.Add(new StyleInclude(new Uri("avares://UniGetUI.Avalonia/"))
25+
{
26+
Source = new Uri($"avares://UniGetUI.Avalonia/Assets/Styles/Styles.{platform}.axaml")
27+
});
1828
}
1929

2030
public override void OnFrameworkInitializationCompleted()
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Styles xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:controls="using:UniGetUI.Avalonia.Views.Controls">
4+
5+
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
6+
7+
<!-- SettingsCard appearance -->
8+
<Style Selector="Border.settings-card">
9+
<Setter Property="Background" Value="{DynamicResource SettingsCardBackground}"/>
10+
<Setter Property="BorderBrush" Value="{DynamicResource SettingsCardBorderBrush}"/>
11+
<Setter Property="Margin" Value="40,0"/>
12+
</Style>
13+
<Style Selector="Border.settings-card-clickable:pointerover">
14+
<Setter Property="Background" Value="{DynamicResource SettingsCardHoverBackground}"/>
15+
</Style>
16+
17+
<!-- Setting warning subtext (amber, both themes) -->
18+
<Style Selector="TextBlock.setting-warning-text">
19+
<Setter Property="Foreground" Value="{DynamicResource SettingWarningTextForeground}"/>
20+
</Style>
21+
22+
<!-- Warning banner (InfoBar-style amber/golden) -->
23+
<Style Selector="Border.warning-banner">
24+
<Setter Property="Background" Value="{DynamicResource WarningBannerBackground}"/>
25+
<Setter Property="BorderBrush" Value="{DynamicResource WarningBannerBorderBrush}"/>
26+
<Setter Property="BorderThickness" Value="1"/>
27+
<Setter Property="Margin" Value="40,4,40,0"/>
28+
</Style>
29+
30+
<!-- SvgIcon: inherit the Fluent foreground so icons match text colour in both themes -->
31+
<Style Selector="controls|SvgIcon">
32+
<Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/>
33+
</Style>
34+
35+
</Styles>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<Styles xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
3+
<Styles.Resources>
4+
<ResourceDictionary>
5+
<ResourceDictionary.ThemeDictionaries>
6+
<ResourceDictionary x:Key="Dark">
7+
<!-- Settings cards -->
8+
<SolidColorBrush x:Key="SettingsCardBackground" Color="#222534"/>
9+
<SolidColorBrush x:Key="SettingsCardBorderBrush" Color="#3a3a3a"/>
10+
<SolidColorBrush x:Key="SettingsCardHoverBackground" Color="#2e3448"/>
11+
<!-- Window structure -->
12+
<SolidColorBrush x:Key="AppWindowBackground" Color="#191b29"/>
13+
<SolidColorBrush x:Key="AppTitleBarBackground" Color="#191b29"/>
14+
<SolidColorBrush x:Key="AppSplitterBackground" Color="#14161a"/>
15+
<SolidColorBrush x:Key="AppOperationsPanelBackground" Color="#16181c"/>
16+
<SolidColorBrush x:Key="AppBorderBrush" Color="#323439"/>
17+
<SolidColorBrush x:Key="AppBadgeBackground" Color="#3c3e44"/>
18+
<!-- Dialogs -->
19+
<SolidColorBrush x:Key="AppDialogBackground" Color="#191b29"/>
20+
<SolidColorBrush x:Key="AppDialogPanelBackground" Color="#2a2d34"/>
21+
<SolidColorBrush x:Key="AppDialogSubtleBackground" Color="#3a3d44"/>
22+
<SolidColorBrush x:Key="AppDialogDarkBackground" Color="#12141a"/>
23+
<!-- Warning banner -->
24+
<SolidColorBrush x:Key="WarningBannerBackground" Color="#3d2800"/>
25+
<SolidColorBrush x:Key="WarningBannerBorderBrush" Color="#7a5200"/>
26+
<SolidColorBrush x:Key="WarningBannerIconBackground" Color="#f0a500"/>
27+
<SolidColorBrush x:Key="WarningBannerIconForeground" Color="#1a1000"/>
28+
<SolidColorBrush x:Key="WarningBannerSubtext" Color="#ffe082"/>
29+
<!-- Setting warning subtext -->
30+
<SolidColorBrush x:Key="SettingWarningTextForeground" Color="#ffc107"/>
31+
</ResourceDictionary>
32+
<ResourceDictionary x:Key="Light">
33+
<!-- Settings cards -->
34+
<SolidColorBrush x:Key="SettingsCardBackground" Color="#fbfbfd"/>
35+
<SolidColorBrush x:Key="SettingsCardBorderBrush" Color="#eff0f3"/>
36+
<SolidColorBrush x:Key="SettingsCardHoverBackground" Color="#f5f6f9"/>
37+
<!-- Window structure -->
38+
<SolidColorBrush x:Key="AppWindowBackground" Color="#f0f3f9"/>
39+
<SolidColorBrush x:Key="AppTitleBarBackground" Color="#f0f3f9"/>
40+
<SolidColorBrush x:Key="AppSplitterBackground" Color="#d8d8d8"/>
41+
<SolidColorBrush x:Key="AppOperationsPanelBackground" Color="#f8f8f8"/>
42+
<SolidColorBrush x:Key="AppBorderBrush" Color="#cccccc"/>
43+
<SolidColorBrush x:Key="AppBadgeBackground" Color="#e0e0e0"/>
44+
<!-- Dialogs -->
45+
<SolidColorBrush x:Key="AppDialogBackground" Color="#ffffff"/>
46+
<SolidColorBrush x:Key="AppDialogPanelBackground" Color="#f5f5f5"/>
47+
<SolidColorBrush x:Key="AppDialogSubtleBackground" Color="#ebebeb"/>
48+
<SolidColorBrush x:Key="AppDialogDarkBackground" Color="#e8e8e8"/>
49+
<!-- Warning banner -->
50+
<SolidColorBrush x:Key="WarningBannerBackground" Color="#fff8e1"/>
51+
<SolidColorBrush x:Key="WarningBannerBorderBrush" Color="#d4a700"/>
52+
<SolidColorBrush x:Key="WarningBannerIconBackground" Color="#f0a500"/>
53+
<SolidColorBrush x:Key="WarningBannerIconForeground" Color="#1a1000"/>
54+
<SolidColorBrush x:Key="WarningBannerSubtext" Color="#7a4f00"/>
55+
<!-- Setting warning subtext -->
56+
<SolidColorBrush x:Key="SettingWarningTextForeground" Color="#a05c00"/>
57+
</ResourceDictionary>
58+
</ResourceDictionary.ThemeDictionaries>
59+
</ResourceDictionary>
60+
</Styles.Resources>
61+
</Styles>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<Styles xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
3+
<Styles.Resources>
4+
<ResourceDictionary>
5+
<ResourceDictionary.ThemeDictionaries>
6+
<ResourceDictionary x:Key="Dark">
7+
<!-- Settings cards -->
8+
<SolidColorBrush x:Key="SettingsCardBackground" Color="#222534"/>
9+
<SolidColorBrush x:Key="SettingsCardBorderBrush" Color="#3a3a3a"/>
10+
<SolidColorBrush x:Key="SettingsCardHoverBackground" Color="#2e3448"/>
11+
<!-- Window structure -->
12+
<SolidColorBrush x:Key="AppWindowBackground" Color="#191b29"/>
13+
<SolidColorBrush x:Key="AppTitleBarBackground" Color="#191b29"/>
14+
<SolidColorBrush x:Key="AppSplitterBackground" Color="#14161a"/>
15+
<SolidColorBrush x:Key="AppOperationsPanelBackground" Color="#16181c"/>
16+
<SolidColorBrush x:Key="AppBorderBrush" Color="#323439"/>
17+
<SolidColorBrush x:Key="AppBadgeBackground" Color="#3c3e44"/>
18+
<!-- Dialogs -->
19+
<SolidColorBrush x:Key="AppDialogBackground" Color="#191b29"/>
20+
<SolidColorBrush x:Key="AppDialogPanelBackground" Color="#2a2d34"/>
21+
<SolidColorBrush x:Key="AppDialogSubtleBackground" Color="#3a3d44"/>
22+
<SolidColorBrush x:Key="AppDialogDarkBackground" Color="#12141a"/>
23+
<!-- Warning banner -->
24+
<SolidColorBrush x:Key="WarningBannerBackground" Color="#3d2800"/>
25+
<SolidColorBrush x:Key="WarningBannerBorderBrush" Color="#7a5200"/>
26+
<SolidColorBrush x:Key="WarningBannerIconBackground" Color="#f0a500"/>
27+
<SolidColorBrush x:Key="WarningBannerIconForeground" Color="#1a1000"/>
28+
<SolidColorBrush x:Key="WarningBannerSubtext" Color="#ffe082"/>
29+
<!-- Setting warning subtext -->
30+
<SolidColorBrush x:Key="SettingWarningTextForeground" Color="#ffc107"/>
31+
</ResourceDictionary>
32+
<ResourceDictionary x:Key="Light">
33+
<!-- Settings cards -->
34+
<SolidColorBrush x:Key="SettingsCardBackground" Color="#fbfbfd"/>
35+
<SolidColorBrush x:Key="SettingsCardBorderBrush" Color="#eff0f3"/>
36+
<SolidColorBrush x:Key="SettingsCardHoverBackground" Color="#f5f6f9"/>
37+
<!-- Window structure -->
38+
<SolidColorBrush x:Key="AppWindowBackground" Color="#f0f3f9"/>
39+
<SolidColorBrush x:Key="AppTitleBarBackground" Color="#f0f3f9"/>
40+
<SolidColorBrush x:Key="AppSplitterBackground" Color="#d8d8d8"/>
41+
<SolidColorBrush x:Key="AppOperationsPanelBackground" Color="#f8f8f8"/>
42+
<SolidColorBrush x:Key="AppBorderBrush" Color="#cccccc"/>
43+
<SolidColorBrush x:Key="AppBadgeBackground" Color="#e0e0e0"/>
44+
<!-- Dialogs -->
45+
<SolidColorBrush x:Key="AppDialogBackground" Color="#ffffff"/>
46+
<SolidColorBrush x:Key="AppDialogPanelBackground" Color="#f5f5f5"/>
47+
<SolidColorBrush x:Key="AppDialogSubtleBackground" Color="#ebebeb"/>
48+
<SolidColorBrush x:Key="AppDialogDarkBackground" Color="#e8e8e8"/>
49+
<!-- Warning banner -->
50+
<SolidColorBrush x:Key="WarningBannerBackground" Color="#fff8e1"/>
51+
<SolidColorBrush x:Key="WarningBannerBorderBrush" Color="#d4a700"/>
52+
<SolidColorBrush x:Key="WarningBannerIconBackground" Color="#f0a500"/>
53+
<SolidColorBrush x:Key="WarningBannerIconForeground" Color="#1a1000"/>
54+
<SolidColorBrush x:Key="WarningBannerSubtext" Color="#7a4f00"/>
55+
<!-- Setting warning subtext -->
56+
<SolidColorBrush x:Key="SettingWarningTextForeground" Color="#a05c00"/>
57+
</ResourceDictionary>
58+
</ResourceDictionary.ThemeDictionaries>
59+
</ResourceDictionary>
60+
</Styles.Resources>
61+
</Styles>

0 commit comments

Comments
 (0)