Skip to content

Commit

Permalink
Refactor project references and package versions
Browse files Browse the repository at this point in the history
- Refactored the project reference to "AuroraControls.Maui.csproj" in the csproj file.
- Updated package references for ReactiveUI.Maui, CommunityToolkit.Mvvm, ReactiveUI.Fody, CommunityToolkit.Maui.Markup, and CommunityToolkit.Maui to their respective versions.
- Made changes to the CupertinoTextToggleSwitch class:
  - Set the thumb color using ThumbColor.ToSKColor().
  - Added a drop shadow effect to the thumb using SKImageFilter.CreateDropShadow().
  - Drawn an oval shape for the thumb using canvas.DrawOval().
  - Set a stroke color and width for the thumb using _thumbPaint.Color and _thumbPaint.StrokeWidth.
  • Loading branch information
michaelstonis committed Oct 19, 2023
1 parent 7370a39 commit 591ebed
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 53 deletions.
110 changes: 60 additions & 50 deletions AuroraControls.TestApp/AuroraControls.TestApp.csproj
Original file line number Diff line number Diff line change
@@ -1,53 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>AuroraControls.TestApp</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Display name -->
<ApplicationTitle>AuroraControls.TestApp</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.auroracontrols.testapp</ApplicationId>
<ApplicationIdGuid>0FAE40EE-5A12-47B7-9497-68477FD7D251</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<MtouchExtraArgs Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">--weak-framework=NewsstandKit.framework/NewsstandKit</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
<CodesignProvision>Automatic</CodesignProvision>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<MtouchFloat32>true</MtouchFloat32>
<MtouchEnableSGenConc>true</MtouchEnableSGenConc>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
<EmbeddedResource Include="Resources\SVG\*.svg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AuroraControlsMaui\AuroraControls.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ReactiveUI.Maui" Version="19.4.1" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageReference Include="ReactiveUI.Fody" Version="19.4.1" />
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="3.2.0" />
<PackageReference Include="CommunityToolkit.Maui" Version="5.3.0" />
</ItemGroup>
<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>AuroraControls.TestApp</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<!-- Display name -->
<ApplicationTitle>AuroraControls.TestApp</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.auroracontrols.testapp</ApplicationId>
<ApplicationIdGuid>0FAE40EE-5A12-47B7-9497-68477FD7D251</ApplicationIdGuid>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<MtouchExtraArgs Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">--weak-framework=NewsstandKit.framework/NewsstandKit</MtouchExtraArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage>
<CodesignProvision>Automatic</CodesignProvision>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<MtouchFloat32>true</MtouchFloat32>
<MtouchEnableSGenConc>true</MtouchEnableSGenConc>
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg"
ForegroundFile="Resources\AppIcon\appiconfg.svg"
Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg"
Color="#512BD4"
BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**"
LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
<EmbeddedResource Include="Resources\SVG\*.svg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AuroraControlsMaui\AuroraControls.Maui.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ReactiveUI.Maui"
Version="19.4.1" />
<PackageReference Include="CommunityToolkit.Mvvm"
Version="8.2.1" />
<PackageReference Include="ReactiveUI.Fody"
Version="19.4.1" />
<PackageReference Include="CommunityToolkit.Maui.Markup"
Version="3.2.0" />
<PackageReference Include="CommunityToolkit.Maui"
Version="5.3.0" />
</ItemGroup>
</Project>
15 changes: 12 additions & 3 deletions AuroraControlsMaui/CupertinoTextToggleSwitch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,15 +445,24 @@ protected override void PaintControl(SKSurface surface, SKImageInfo info)

instanceCalculatedWidth += (float)Math.Max(enabledTextSize.Width, disabledTextSize.Width);

_thumbPaint.Color = ThumbColor.ToSKColor();
var thumbColor = ThumbColor.ToSKColor();
_thumbPaint.Color = thumbColor;
_thumbPaint.Style = SKPaintStyle.Fill;
_thumbPaint.IsAntialias = true;

var shadowSigma = SKMaskFilter.ConvertRadiusToSigma(borderWidth);
_thumbPaint.ImageFilter =
SKImageFilter
.CreateDropShadow(
0, 0, 4f, 4f,
SKColors.DarkGray);
0, 0, shadowSigma, shadowSigma,
trackColor.Lerp(SKColors.Black, .9d));

canvas.DrawOval(thumbRect, _thumbPaint);

_thumbPaint.Color = thumbColor.Lerp(SKColors.DarkGray, .6d);
_thumbPaint.StrokeWidth = borderWidth * .2f;
_thumbPaint.ImageFilter = null;
_thumbPaint.Style = SKPaintStyle.Stroke;
canvas.DrawOval(thumbRect, _thumbPaint);

// This gets calculated 2x because we need it as a buffer for the text.
Expand Down

0 comments on commit 591ebed

Please sign in to comment.