Skip to content

Commit 0de0401

Browse files
authored
fix: FreakySwitch rewritten and FreakyButton with Visual states changes (#111)
1 parent 6df0896 commit 0de0401

File tree

21 files changed

+379
-134
lines changed

21 files changed

+379
-134
lines changed

MAUI.FreakyControls/MAUI.FreakyControls/Maui.FreakyControls.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<RootNamespace>Maui.FreakyControls</RootNamespace>
1515
<AssemblyVersion>0.4.10</AssemblyVersion>
1616
<AssemblyFileVersion>0.4.10</AssemblyFileVersion>
17-
<Version>0.4.10-pre</Version>
17+
<Version>0.4.10</Version>
1818
<NeutralLanguage>en</NeutralLanguage>
1919
<!--Version of C# to use -->
2020
<PackageId>FreakyControls</PackageId>
@@ -26,7 +26,7 @@
2626
<RepositoryUrl>https://github.com/FreakyAli/MAUI.FreakyControls</RepositoryUrl>
2727
<PackageProjectUrl>https://github.com/FreakyAli/MAUI.FreakyControls</PackageProjectUrl>
2828
<PackageTags>Maui dotnet.Maui .net-Maui FreakyControls CodeView OTP PinCodeView Switch AutoComplete JumpList Button Checkbox uikit Signature Radiobutton SignatureView Svg CircularImage TextInputLayout</PackageTags>
29-
<PackageReleaseNotes>.NET 8 Support for your favorite Freaky Controls!!!</PackageReleaseNotes>
29+
<PackageReleaseNotes>FreakySwitch rewritten and changes and visual state changes</PackageReleaseNotes>
3030
<PackageReadmeFile>readme.md</PackageReadmeFile>
3131
<Copyright>Copyright 2023</Copyright>
3232
<PackOnBuild>true</PackOnBuild>
@@ -140,8 +140,8 @@
140140
<ItemGroup>
141141
<PackageReference Include="SkiaSharp.Views.Maui.Controls" Version="2.88.7" />
142142
<PackageReference Include="SkiaSharp.Svg" Version="1.60.0" />
143-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.6" />
144-
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.6" />
143+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" />
144+
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.7" />
145145
<PackageReference Include="FreakyEffects" Version="0.1.1-pre" />
146146
</ItemGroup>
147147
<ItemGroup>

MAUI.FreakyControls/MAUI.FreakyControls/Shared/Extensions/AssemblyNotFoundException.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
#if ANDROID
2-
#endif
3-
#if IOS
4-
using Maui.FreakyControls.Platforms.iOS;
5-
using Microsoft.Maui.Controls.Compatibility.Platform.iOS;
6-
using NativeColor = UIKit.UIColor;
7-
using NativeImage = UIKit.UIImage;
8-
#endif
9-
10-
namespace Maui.FreakyControls.Extensions
1+
namespace Maui.FreakyControls.Extensions
112
{
123
public class AssemblyNotFoundException : Exception
134
{

MAUI.FreakyControls/MAUI.FreakyControls/Shared/Extensions/Extensions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ namespace Maui.FreakyControls.Extensions;
2727

2828
public static class Extensions
2929
{
30+
public static bool IsAndroid => DeviceInfo.Current.Platform == DevicePlatform.Android;
31+
32+
public static bool IsiOS => DeviceInfo.Current.Platform == DevicePlatform.iOS;
33+
3034
public static void ExecuteCommandIfAvailable(this ICommand command, object parameter = null)
3135
{
3236
if (command?.CanExecute(parameter) == true)
@@ -61,7 +65,6 @@ private static void AddHandlers(this IMauiHandlersCollection handlers)
6165
handlers.AddHandler(typeof(FreakyPicker), typeof(FreakyPickerHandler));
6266
handlers.AddHandler(typeof(FreakyImage), typeof(FreakyImageHandler));
6367
handlers.AddHandler(typeof(FreakySignatureCanvasView), typeof(FreakySignatureCanvasViewHandler));
64-
handlers.AddHandler(typeof(FreakySwitch), typeof(FreakySwitchHandler));
6568
handlers.AddHandler(typeof(FreakyAutoCompleteView), typeof(FreakyAutoCompleteViewHandler));
6669
}
6770

MAUI.FreakyControls/MAUI.FreakyControls/Shared/FreakyButton/FreakyButton.xaml.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,5 +409,14 @@ private async void Button_Tapped(object sender, TappedEventArgs e)
409409
Command?.ExecuteCommandIfAvailable(CommandParameter);
410410
}
411411

412+
protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)
413+
{
414+
base.OnPropertyChanged(propertyName);
415+
if (propertyName == nameof(IsEnabled))
416+
{
417+
ChangeVisualState();
418+
}
419+
}
420+
412421
#endregion Methods
413422
}

MAUI.FreakyControls/MAUI.FreakyControls/Shared/FreakyCheckbox/FreakyCheckbox.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,10 @@ private async Task PostAnimateAsync()
195195
private void Handle_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
196196
{
197197
e?.Surface?.Canvas?.Clear();
198-
DrawOutline(e);
199198
if (IsChecked)
200199
DrawCheckFilled(e);
200+
else
201+
DrawOutline(e);
201202
}
202203

203204
private void DrawCheckFilled(SKPaintSurfaceEventArgs e)

MAUI.FreakyControls/MAUI.FreakyControls/Shared/FreakyPicker/FreakyPicker.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,43 @@ public class FreakyPicker : Picker, IDrawableImageView
88
public static readonly BindableProperty ImageSourceProperty = BindableProperty.Create(
99
nameof(Image),
1010
typeof(ImageSource),
11-
typeof(FreakyDatePicker),
11+
typeof(FreakyPicker),
1212
default(ImageSource));
1313

1414
public static readonly BindableProperty ImageHeightProperty = BindableProperty.Create(
1515
nameof(ImageHeight),
1616
typeof(int),
17-
typeof(FreakyDatePicker),
17+
typeof(FreakyPicker),
1818
25);
1919

2020
public static readonly BindableProperty ImageWidthProperty = BindableProperty.Create(
2121
nameof(ImageWidth),
2222
typeof(int),
23-
typeof(FreakyDatePicker),
23+
typeof(FreakyPicker),
2424
25);
2525

2626
public static readonly BindableProperty ImageAlignmentProperty = BindableProperty.Create(
2727
nameof(ImageAlignment),
2828
typeof(ImageAlignment),
29-
typeof(FreakyDatePicker),
29+
typeof(FreakyPicker),
3030
ImageAlignment.Right);
3131

3232
public static readonly BindableProperty ImagePaddingProperty = BindableProperty.Create(
3333
nameof(ImagePadding),
3434
typeof(int),
35-
typeof(FreakyDatePicker),
35+
typeof(FreakyPicker),
3636
5);
3737

3838
public static readonly BindableProperty ImageCommandProperty = BindableProperty.Create(
3939
nameof(ImagePadding),
4040
typeof(ICommand),
41-
typeof(FreakyDatePicker),
41+
typeof(FreakyPicker),
4242
default(ICommand));
4343

4444
public static readonly BindableProperty ImageCommandParameterProperty = BindableProperty.Create(
4545
nameof(ImageCommandParameter),
4646
typeof(object),
47-
typeof(FreakyDatePicker),
47+
typeof(FreakyPicker),
4848
default(object));
4949

5050
/// <summary>

MAUI.FreakyControls/MAUI.FreakyControls/Shared/FreakyRadioButton/FreakyRadioButton.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ private void Radiobutton_Tapped(object sender, EventArgs e)
5454
private void Handle_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
5555
{
5656
e?.Surface?.Canvas?.Clear();
57-
DrawOutline(e);
5857
if (IsChecked)
5958
DrawCheckFilled(e);
59+
else
60+
DrawOutline(e);
6061
}
6162

6263
/// <summary>

0 commit comments

Comments
 (0)