forked from creewick/uWidgets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
178 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace uWidgets.ViewModels; | ||
|
||
public record DarkModeViewModel(string Name, bool? Value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
using System; | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Media; | ||
|
||
namespace uWidgets.ViewModels; | ||
|
||
public record ThemeViewModel(string Name, bool? Value); | ||
public record ThemeViewModel(bool UseNativeFrame, FontFamily FontFamily, bool IsSelected, Action Apply) | ||
{ | ||
public CornerRadius CornerRadius => new(Radius); | ||
public double Radius => UseNativeFrame ? 2 : 8; | ||
public Thickness BorderThickness => new(UseNativeFrame ? 1 : 0); | ||
public BoxShadows Shadow => UseNativeFrame | ||
? new(BoxShadow.Parse("0 0 10 0 #40000000")) | ||
: new(); | ||
|
||
public Classes Classes => IsSelected ? ["Active"] : []; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:viewModels="clr-namespace:uWidgets.ViewModels" | ||
x:Class="uWidgets.Views.Controls.ThemeButton" | ||
x:DataType="viewModels:ThemeViewModel"> | ||
<Button Click="Button_OnClick" Padding="1" CornerRadius="5" Background="Transparent"> | ||
<Canvas Width="115" Height="90" ClipToBounds="True"> | ||
<Rectangle Width="115" Height="90" RadiusX="4" RadiusY="4" | ||
Fill="{DynamicResource ThemeBackgroundBrush}" /> | ||
<Border Canvas.Left="65" Canvas.Top="40" Width="45" Height="45" | ||
CornerRadius="{Binding CornerRadius}" | ||
Background="{DynamicResource WidgetBackground}" | ||
BorderThickness="{Binding BorderThickness}" | ||
BorderBrush="#60808080" | ||
BoxShadow="{Binding Shadow}" /> | ||
<TextBlock Canvas.Left="65" Canvas.Top="48" Width="45" | ||
TextAlignment="Center" VerticalAlignment="Center" | ||
FontSize="28" LineHeight="24" Text="Aa" | ||
FontFamily="{Binding FontFamily}" | ||
Foreground="{DynamicResource SystemControlForegroundAccentBrush}" /> | ||
</Canvas> | ||
</Button> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Avalonia.Controls; | ||
using Avalonia.Interactivity; | ||
using uWidgets.ViewModels; | ||
|
||
namespace uWidgets.Views.Controls; | ||
|
||
public partial class ThemeButton : UserControl | ||
{ | ||
public ThemeButton() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void Button_OnClick(object? sender, RoutedEventArgs e) | ||
{ | ||
(DataContext as ThemeViewModel)!.Apply(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.