From 317aaaf23c1c70457ad44d0caba1f9227a8caee8 Mon Sep 17 00:00:00 2001 From: Dave Friedel Date: Thu, 1 Jan 2026 13:59:47 -0500 Subject: [PATCH] Verify and fix handlers against decompiled production MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ImageHandler.Linux.cs: Verified matches production - ScrollViewHandler.Linux.cs: Verified matches production - StepperHandler.Linux.cs: Verified matches production - RadioButtonHandler.Linux.cs: Verified matches production - SearchBarHandler.Linux.cs: Fixed namespace, added CancelButtonColor, SolidPaint, null checks - ImageButtonHandler.cs: Verified matches production - DatePickerHandler.cs: Verified matches production - TimePickerHandler.cs: Verified matches production 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- Handlers/ImageHandler.Linux.cs | 308 +++++++++++++++++++++++++++ Handlers/RadioButtonHandler.Linux.cs | 105 +++++++++ Handlers/ScrollViewHandler.Linux.cs | 109 ++++++++++ Handlers/SearchBarHandler.Linux.cs | 111 ++++++---- Handlers/StepperHandler.Linux.cs | 127 +++++++++++ MERGE_TRACKING.md | 16 +- 6 files changed, 727 insertions(+), 49 deletions(-) create mode 100644 Handlers/ImageHandler.Linux.cs create mode 100644 Handlers/RadioButtonHandler.Linux.cs create mode 100644 Handlers/ScrollViewHandler.Linux.cs create mode 100644 Handlers/StepperHandler.Linux.cs diff --git a/Handlers/ImageHandler.Linux.cs b/Handlers/ImageHandler.Linux.cs new file mode 100644 index 0000000..d4495ac --- /dev/null +++ b/Handlers/ImageHandler.Linux.cs @@ -0,0 +1,308 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.IO; +using System.Threading; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Graphics; +using Microsoft.Maui.Handlers; +using SkiaSharp; + +namespace Microsoft.Maui.Platform.Linux.Handlers; + +/// +/// Linux handler for Image control. +/// +public class ImageHandler : ViewHandler +{ + internal class ImageSourceServiceResultManager + { + private readonly ImageHandler _handler; + private CancellationTokenSource? _cts; + + public ImageSourceServiceResultManager(ImageHandler handler) + { + _handler = handler; + } + + public async void UpdateImageSourceAsync() + { + _cts?.Cancel(); + _cts = new CancellationTokenSource(); + var token = _cts.Token; + + try + { + var source = _handler.VirtualView?.Source; + if (source == null) + { + _handler.PlatformView?.LoadFromData(Array.Empty()); + return; + } + + if (_handler.VirtualView is IImageSourcePart imagePart) + { + imagePart.UpdateIsLoading(true); + } + + if (source is IFileImageSource fileSource) + { + var file = fileSource.File; + if (!string.IsNullOrEmpty(file)) + { + await _handler.PlatformView.LoadFromFileAsync(file); + } + return; + } + + if (source is IUriImageSource uriSource) + { + var uri = uriSource.Uri; + if (uri != null) + { + await _handler.PlatformView.LoadFromUriAsync(uri); + } + return; + } + + if (source is IStreamImageSource streamSource) + { + var stream = await streamSource.GetStreamAsync(token); + if (stream != null) + { + await _handler.PlatformView.LoadFromStreamAsync(stream); + } + return; + } + + if (source is FontImageSource fontSource) + { + var bitmap = RenderFontImageSource(fontSource, _handler.PlatformView.WidthRequest, _handler.PlatformView.HeightRequest); + if (bitmap != null) + { + _handler.PlatformView.LoadFromBitmap(bitmap); + } + } + } + catch (OperationCanceledException) + { + // Cancelled - ignore + } + catch (Exception) + { + if (_handler.VirtualView is IImageSourcePart imagePart) + { + imagePart.UpdateIsLoading(false); + } + } + } + + private static SKBitmap? RenderFontImageSource(FontImageSource fontSource, double requestedWidth, double requestedHeight) + { + var glyph = fontSource.Glyph; + if (string.IsNullOrEmpty(glyph)) + { + return null; + } + + int size = (int)Math.Max( + requestedWidth > 0 ? requestedWidth : 24.0, + requestedHeight > 0 ? requestedHeight : 24.0); + size = Math.Max(size, 16); + + var color = fontSource.Color?.ToSKColor() ?? SKColors.Black; + var bitmap = new SKBitmap(size, size, false); + + using var canvas = new SKCanvas(bitmap); + canvas.Clear(SKColors.Transparent); + + SKTypeface? typeface = null; + if (!string.IsNullOrEmpty(fontSource.FontFamily)) + { + var fontPaths = new[] + { + "/usr/share/fonts/truetype/" + fontSource.FontFamily + ".ttf", + "/usr/share/fonts/opentype/" + fontSource.FontFamily + ".otf", + "/usr/local/share/fonts/" + fontSource.FontFamily + ".ttf", + Path.Combine(AppContext.BaseDirectory, fontSource.FontFamily + ".ttf") + }; + + foreach (var path in fontPaths) + { + if (File.Exists(path)) + { + typeface = SKTypeface.FromFile(path); + if (typeface != null) + break; + } + } + + if (typeface == null) + { + typeface = SKTypeface.FromFamilyName(fontSource.FontFamily); + } + } + + typeface ??= SKTypeface.Default; + + float fontSize = size * 0.8f; + using var font = new SKFont(typeface, fontSize); + using var paint = new SKPaint(font) + { + Color = color, + IsAntialias = true, + TextAlign = SKTextAlign.Center + }; + + var bounds = new SKRect(); + paint.MeasureText(glyph, ref bounds); + + float x = size / 2f; + float y = (size - bounds.Top - bounds.Bottom) / 2f; + canvas.DrawText(glyph, x, y, paint); + + return bitmap; + } + } + + public static IPropertyMapper Mapper = new PropertyMapper(ViewHandler.ViewMapper) + { + ["Aspect"] = MapAspect, + ["IsOpaque"] = MapIsOpaque, + ["Source"] = MapSource, + ["Background"] = MapBackground, + ["Width"] = MapWidth, + ["Height"] = MapHeight + }; + + public static CommandMapper CommandMapper = new(ViewHandler.ViewCommandMapper); + + private ImageSourceServiceResultManager? _sourceLoader; + private ImageSourceServiceResultManager SourceLoader => _sourceLoader ??= new ImageSourceServiceResultManager(this); + + public ImageHandler() : base(Mapper, CommandMapper) + { + } + + public ImageHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null) + : base(mapper ?? Mapper, commandMapper ?? CommandMapper) + { + } + + protected override SkiaImage CreatePlatformView() + { + return new SkiaImage(); + } + + protected override void ConnectHandler(SkiaImage platformView) + { + base.ConnectHandler(platformView); + platformView.ImageLoaded += OnImageLoaded; + platformView.ImageLoadingError += OnImageLoadingError; + } + + protected override void DisconnectHandler(SkiaImage platformView) + { + platformView.ImageLoaded -= OnImageLoaded; + platformView.ImageLoadingError -= OnImageLoadingError; + base.DisconnectHandler(platformView); + } + + private void OnImageLoaded(object? sender, EventArgs e) + { + if (VirtualView is IImageSourcePart imagePart) + { + imagePart.UpdateIsLoading(false); + } + } + + private void OnImageLoadingError(object? sender, ImageLoadingErrorEventArgs e) + { + if (VirtualView is IImageSourcePart imagePart) + { + imagePart.UpdateIsLoading(false); + } + } + + public static void MapAspect(ImageHandler handler, IImage image) + { + if (handler.PlatformView != null) + { + handler.PlatformView.Aspect = image.Aspect; + } + } + + public static void MapIsOpaque(ImageHandler handler, IImage image) + { + if (handler.PlatformView != null) + { + handler.PlatformView.IsOpaque = image.IsOpaque; + } + } + + public static void MapSource(ImageHandler handler, IImage image) + { + if (handler.PlatformView == null) + { + return; + } + + if (image is Image mauiImage) + { + if (mauiImage.WidthRequest > 0) + { + handler.PlatformView.WidthRequest = mauiImage.WidthRequest; + } + if (mauiImage.HeightRequest > 0) + { + handler.PlatformView.HeightRequest = mauiImage.HeightRequest; + } + } + + handler.SourceLoader.UpdateImageSourceAsync(); + } + + public static void MapBackground(ImageHandler handler, IImage image) + { + if (handler.PlatformView != null) + { + if (image.Background is SolidPaint solidPaint && solidPaint.Color != null) + { + handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor(); + } + } + } + + public static void MapWidth(ImageHandler handler, IImage image) + { + if (handler.PlatformView != null) + { + if (image is Image mauiImage && mauiImage.WidthRequest > 0) + { + handler.PlatformView.WidthRequest = mauiImage.WidthRequest; + Console.WriteLine($"[ImageHandler] MapWidth: {mauiImage.WidthRequest}"); + } + else if (image.Width > 0) + { + handler.PlatformView.WidthRequest = image.Width; + } + } + } + + public static void MapHeight(ImageHandler handler, IImage image) + { + if (handler.PlatformView != null) + { + if (image is Image mauiImage && mauiImage.HeightRequest > 0) + { + handler.PlatformView.HeightRequest = mauiImage.HeightRequest; + Console.WriteLine($"[ImageHandler] MapHeight: {mauiImage.HeightRequest}"); + } + else if (image.Height > 0) + { + handler.PlatformView.HeightRequest = image.Height; + } + } + } +} diff --git a/Handlers/RadioButtonHandler.Linux.cs b/Handlers/RadioButtonHandler.Linux.cs new file mode 100644 index 0000000..aeb1bfc --- /dev/null +++ b/Handlers/RadioButtonHandler.Linux.cs @@ -0,0 +1,105 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Graphics; +using Microsoft.Maui.Handlers; + +namespace Microsoft.Maui.Platform.Linux.Handlers; + +/// +/// Linux handler for RadioButton control. +/// +public class RadioButtonHandler : ViewHandler +{ + public static IPropertyMapper Mapper = new PropertyMapper(ViewHandler.ViewMapper) + { + ["IsChecked"] = MapIsChecked, + ["TextColor"] = MapTextColor, + ["Font"] = MapFont, + ["Background"] = MapBackground + }; + + public static CommandMapper CommandMapper = new(ViewHandler.ViewCommandMapper); + + public RadioButtonHandler() : base(Mapper, CommandMapper) + { + } + + public RadioButtonHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null) + : base(mapper ?? Mapper, commandMapper ?? CommandMapper) + { + } + + protected override SkiaRadioButton CreatePlatformView() + { + return new SkiaRadioButton(); + } + + protected override void ConnectHandler(SkiaRadioButton platformView) + { + base.ConnectHandler(platformView); + platformView.CheckedChanged += OnCheckedChanged; + + if (VirtualView is RadioButton radioButton) + { + platformView.Content = radioButton.Content?.ToString() ?? ""; + platformView.GroupName = radioButton.GroupName; + platformView.Value = radioButton.Value; + } + } + + protected override void DisconnectHandler(SkiaRadioButton platformView) + { + platformView.CheckedChanged -= OnCheckedChanged; + base.DisconnectHandler(platformView); + } + + private void OnCheckedChanged(object? sender, EventArgs e) + { + if (VirtualView != null && PlatformView != null) + { + VirtualView.IsChecked = PlatformView.IsChecked; + } + } + + public static void MapIsChecked(RadioButtonHandler handler, IRadioButton radioButton) + { + if (handler.PlatformView != null) + { + handler.PlatformView.IsChecked = radioButton.IsChecked; + } + } + + public static void MapTextColor(RadioButtonHandler handler, IRadioButton radioButton) + { + if (handler.PlatformView != null && radioButton.TextColor != null) + { + handler.PlatformView.TextColor = radioButton.TextColor.ToSKColor(); + } + } + + public static void MapFont(RadioButtonHandler handler, IRadioButton radioButton) + { + if (handler.PlatformView != null) + { + var font = radioButton.Font; + if (font.Size > 0) + { + handler.PlatformView.FontSize = (float)font.Size; + } + } + } + + public static void MapBackground(RadioButtonHandler handler, IRadioButton radioButton) + { + if (handler.PlatformView != null) + { + if (radioButton.Background is SolidPaint solidPaint && solidPaint.Color != null) + { + handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor(); + } + } + } +} diff --git a/Handlers/ScrollViewHandler.Linux.cs b/Handlers/ScrollViewHandler.Linux.cs new file mode 100644 index 0000000..d058ea8 --- /dev/null +++ b/Handlers/ScrollViewHandler.Linux.cs @@ -0,0 +1,109 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using Microsoft.Maui.Handlers; +using Microsoft.Maui.Platform.Linux.Hosting; + +namespace Microsoft.Maui.Platform.Linux.Handlers; + +/// +/// Linux handler for ScrollView control. +/// +public class ScrollViewHandler : ViewHandler +{ + public static IPropertyMapper Mapper = new PropertyMapper(ViewHandler.ViewMapper) + { + ["Content"] = MapContent, + ["HorizontalScrollBarVisibility"] = MapHorizontalScrollBarVisibility, + ["VerticalScrollBarVisibility"] = MapVerticalScrollBarVisibility, + ["Orientation"] = MapOrientation + }; + + public static CommandMapper CommandMapper = new(ViewHandler.ViewCommandMapper) + { + ["RequestScrollTo"] = MapRequestScrollTo + }; + + public ScrollViewHandler() : base(Mapper, CommandMapper) + { + } + + public ScrollViewHandler(IPropertyMapper? mapper) + : base(mapper ?? Mapper, CommandMapper) + { + } + + protected override SkiaScrollView CreatePlatformView() + { + return new SkiaScrollView(); + } + + public static void MapContent(ScrollViewHandler handler, IScrollView scrollView) + { + if (handler.PlatformView == null || handler.MauiContext == null) + { + return; + } + + var presentedContent = scrollView.PresentedContent; + if (presentedContent != null) + { + Console.WriteLine("[ScrollViewHandler] MapContent: " + presentedContent.GetType().Name); + + if (presentedContent.Handler == null) + { + presentedContent.Handler = presentedContent.ToViewHandler(handler.MauiContext); + } + + if (presentedContent.Handler?.PlatformView is SkiaView skiaView) + { + Console.WriteLine("[ScrollViewHandler] Setting content: " + skiaView.GetType().Name); + handler.PlatformView.Content = skiaView; + } + } + else + { + handler.PlatformView.Content = null; + } + } + + public static void MapHorizontalScrollBarVisibility(ScrollViewHandler handler, IScrollView scrollView) + { + handler.PlatformView.HorizontalScrollBarVisibility = (int)scrollView.HorizontalScrollBarVisibility switch + { + 1 => ScrollBarVisibility.Always, + 2 => ScrollBarVisibility.Never, + _ => ScrollBarVisibility.Default + }; + } + + public static void MapVerticalScrollBarVisibility(ScrollViewHandler handler, IScrollView scrollView) + { + handler.PlatformView.VerticalScrollBarVisibility = (int)scrollView.VerticalScrollBarVisibility switch + { + 1 => ScrollBarVisibility.Always, + 2 => ScrollBarVisibility.Never, + _ => ScrollBarVisibility.Default + }; + } + + public static void MapOrientation(ScrollViewHandler handler, IScrollView scrollView) + { + handler.PlatformView.Orientation = ((int)scrollView.Orientation - 1) switch + { + 0 => ScrollOrientation.Horizontal, + 1 => ScrollOrientation.Both, + 2 => ScrollOrientation.Neither, + _ => ScrollOrientation.Vertical + }; + } + + public static void MapRequestScrollTo(ScrollViewHandler handler, IScrollView scrollView, object? args) + { + if (args is ScrollToRequest request) + { + handler.PlatformView.ScrollTo((float)request.HorizontalOffset, (float)request.VerticalOffset, !request.Instant); + } + } +} diff --git a/Handlers/SearchBarHandler.Linux.cs b/Handlers/SearchBarHandler.Linux.cs index bc9c9f6..0e7cf6a 100644 --- a/Handlers/SearchBarHandler.Linux.cs +++ b/Handlers/SearchBarHandler.Linux.cs @@ -1,31 +1,43 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; +using Microsoft.Maui.Graphics; using Microsoft.Maui.Handlers; -namespace Microsoft.Maui.Platform; +namespace Microsoft.Maui.Platform.Linux.Handlers; /// /// Linux handler for SearchBar control. /// -public partial class SearchBarHandler : ViewHandler +public class SearchBarHandler : ViewHandler { public static IPropertyMapper Mapper = new PropertyMapper(ViewHandler.ViewMapper) { - [nameof(ISearchBar.Text)] = MapText, - [nameof(ISearchBar.Placeholder)] = MapPlaceholder, - [nameof(ISearchBar.PlaceholderColor)] = MapPlaceholderColor, - [nameof(ISearchBar.TextColor)] = MapTextColor, - [nameof(ISearchBar.Font)] = MapFont, - [nameof(IView.IsEnabled)] = MapIsEnabled, - [nameof(IView.Background)] = MapBackground, + ["Text"] = MapText, + ["TextColor"] = MapTextColor, + ["Font"] = MapFont, + ["Placeholder"] = MapPlaceholder, + ["PlaceholderColor"] = MapPlaceholderColor, + ["CancelButtonColor"] = MapCancelButtonColor, + ["Background"] = MapBackground }; public static CommandMapper CommandMapper = new(ViewHandler.ViewCommandMapper); - public SearchBarHandler() : base(Mapper, CommandMapper) { } + public SearchBarHandler() : base(Mapper, CommandMapper) + { + } - protected override SkiaSearchBar CreatePlatformView() => new SkiaSearchBar(); + public SearchBarHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null) + : base(mapper ?? Mapper, commandMapper ?? CommandMapper) + { + } + + protected override SkiaSearchBar CreatePlatformView() + { + return new SkiaSearchBar(); + } protected override void ConnectHandler(SkiaSearchBar platformView) { @@ -43,9 +55,9 @@ public partial class SearchBarHandler : ViewHandler private void OnTextChanged(object? sender, TextChangedEventArgs e) { - if (VirtualView != null && VirtualView.Text != e.NewText) + if (VirtualView != null && PlatformView != null && VirtualView.Text != e.NewTextValue) { - VirtualView.Text = e.NewText; + VirtualView.Text = e.NewTextValue ?? string.Empty; } } @@ -56,51 +68,68 @@ public partial class SearchBarHandler : ViewHandler public static void MapText(SearchBarHandler handler, ISearchBar searchBar) { - if (handler.PlatformView.Text != searchBar.Text) + if (handler.PlatformView != null && handler.PlatformView.Text != searchBar.Text) { - handler.PlatformView.Text = searchBar.Text ?? ""; + handler.PlatformView.Text = searchBar.Text ?? string.Empty; + } + } + + public static void MapTextColor(SearchBarHandler handler, ISearchBar searchBar) + { + if (handler.PlatformView != null && searchBar.TextColor != null) + { + handler.PlatformView.TextColor = searchBar.TextColor.ToSKColor(); + } + } + + public static void MapFont(SearchBarHandler handler, ISearchBar searchBar) + { + if (handler.PlatformView != null) + { + var font = searchBar.Font; + if (font.Size > 0) + { + handler.PlatformView.FontSize = (float)font.Size; + } + if (!string.IsNullOrEmpty(font.Family)) + { + handler.PlatformView.FontFamily = font.Family; + } } } public static void MapPlaceholder(SearchBarHandler handler, ISearchBar searchBar) { - handler.PlatformView.Placeholder = searchBar.Placeholder ?? ""; - handler.PlatformView.Invalidate(); + if (handler.PlatformView != null) + { + handler.PlatformView.Placeholder = searchBar.Placeholder ?? string.Empty; + } } public static void MapPlaceholderColor(SearchBarHandler handler, ISearchBar searchBar) { - if (searchBar.PlaceholderColor != null) + if (handler.PlatformView != null && searchBar.PlaceholderColor != null) + { handler.PlatformView.PlaceholderColor = searchBar.PlaceholderColor.ToSKColor(); - handler.PlatformView.Invalidate(); + } } - public static void MapTextColor(SearchBarHandler handler, ISearchBar searchBar) + public static void MapCancelButtonColor(SearchBarHandler handler, ISearchBar searchBar) { - if (searchBar.TextColor != null) - handler.PlatformView.TextColor = searchBar.TextColor.ToSKColor(); - handler.PlatformView.Invalidate(); - } - - public static void MapFont(SearchBarHandler handler, ISearchBar searchBar) - { - var font = searchBar.Font; - if (font.Family != null) - handler.PlatformView.FontFamily = font.Family; - handler.PlatformView.FontSize = (float)font.Size; - handler.PlatformView.Invalidate(); - } - - public static void MapIsEnabled(SearchBarHandler handler, ISearchBar searchBar) - { - handler.PlatformView.IsEnabled = searchBar.IsEnabled; - handler.PlatformView.Invalidate(); + if (handler.PlatformView != null && searchBar.CancelButtonColor != null) + { + handler.PlatformView.ClearButtonColor = searchBar.CancelButtonColor.ToSKColor(); + } } public static void MapBackground(SearchBarHandler handler, ISearchBar searchBar) { - if (searchBar.Background is SolidColorBrush solidBrush && solidBrush.Color != null) - handler.PlatformView.BackgroundColor = solidBrush.Color.ToSKColor(); - handler.PlatformView.Invalidate(); + if (handler.PlatformView != null) + { + if (searchBar.Background is SolidPaint solidPaint && solidPaint.Color != null) + { + handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor(); + } + } } } diff --git a/Handlers/StepperHandler.Linux.cs b/Handlers/StepperHandler.Linux.cs new file mode 100644 index 0000000..e658ba1 --- /dev/null +++ b/Handlers/StepperHandler.Linux.cs @@ -0,0 +1,127 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Graphics; +using Microsoft.Maui.Handlers; +using SkiaSharp; + +namespace Microsoft.Maui.Platform.Linux.Handlers; + +/// +/// Linux handler for Stepper control. +/// +public class StepperHandler : ViewHandler +{ + public static IPropertyMapper Mapper = new PropertyMapper(ViewHandler.ViewMapper) + { + ["Value"] = MapValue, + ["Minimum"] = MapMinimum, + ["Maximum"] = MapMaximum, + ["Increment"] = MapIncrement, + ["Background"] = MapBackground, + ["IsEnabled"] = MapIsEnabled + }; + + public static CommandMapper CommandMapper = new(ViewHandler.ViewCommandMapper); + + public StepperHandler() : base(Mapper, CommandMapper) + { + } + + public StepperHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null) + : base(mapper ?? Mapper, commandMapper ?? CommandMapper) + { + } + + protected override SkiaStepper CreatePlatformView() + { + return new SkiaStepper(); + } + + protected override void ConnectHandler(SkiaStepper platformView) + { + base.ConnectHandler(platformView); + platformView.ValueChanged += OnValueChanged; + + // Apply dark theme colors if needed + if (Application.Current?.UserAppTheme == AppTheme.Dark) + { + platformView.ButtonBackgroundColor = new SKColor(66, 66, 66); + platformView.ButtonPressedColor = new SKColor(97, 97, 97); + platformView.ButtonDisabledColor = new SKColor(48, 48, 48); + platformView.SymbolColor = new SKColor(224, 224, 224); + platformView.SymbolDisabledColor = new SKColor(97, 97, 97); + platformView.BorderColor = new SKColor(97, 97, 97); + } + } + + protected override void DisconnectHandler(SkiaStepper platformView) + { + platformView.ValueChanged -= OnValueChanged; + base.DisconnectHandler(platformView); + } + + private void OnValueChanged(object? sender, EventArgs e) + { + if (VirtualView != null && PlatformView != null) + { + VirtualView.Value = PlatformView.Value; + } + } + + public static void MapValue(StepperHandler handler, IStepper stepper) + { + if (handler.PlatformView != null) + { + handler.PlatformView.Value = stepper.Value; + } + } + + public static void MapMinimum(StepperHandler handler, IStepper stepper) + { + if (handler.PlatformView != null) + { + handler.PlatformView.Minimum = stepper.Minimum; + } + } + + public static void MapMaximum(StepperHandler handler, IStepper stepper) + { + if (handler.PlatformView != null) + { + handler.PlatformView.Maximum = stepper.Maximum; + } + } + + public static void MapBackground(StepperHandler handler, IStepper stepper) + { + if (handler.PlatformView != null) + { + if (stepper.Background is SolidPaint solidPaint && solidPaint.Color != null) + { + handler.PlatformView.BackgroundColor = solidPaint.Color.ToSKColor(); + } + } + } + + public static void MapIncrement(StepperHandler handler, IStepper stepper) + { + if (handler.PlatformView != null) + { + if (stepper is Stepper mauiStepper) + { + handler.PlatformView.Increment = mauiStepper.Increment; + } + } + } + + public static void MapIsEnabled(StepperHandler handler, IStepper stepper) + { + if (handler.PlatformView != null) + { + handler.PlatformView.IsEnabled = stepper.IsEnabled; + } + } +} diff --git a/MERGE_TRACKING.md b/MERGE_TRACKING.md index ac642d7..cd02eae 100644 --- a/MERGE_TRACKING.md +++ b/MERGE_TRACKING.md @@ -19,7 +19,7 @@ | ButtonHandler.Linux.cs | [x] | **FIXED 2026-01-01** - Removed MapText/TextColor/Font (not in production), fixed namespace, added null checks | | CheckBoxHandler.Linux.cs | [x] | **FIXED 2026-01-01** - Added VerticalLayoutAlignment/HorizontalLayoutAlignment, fixed namespace | | CollectionViewHandler.cs | [ ] | NEEDS VERIFICATION | -| DatePickerHandler.cs | [ ] | NEEDS VERIFICATION | +| DatePickerHandler.cs | [x] | **VERIFIED 2026-01-01** - Matches production, dark theme support | | EditorHandler.Linux.cs | [x] | **CREATED 2026-01-01** - Was missing, created from decompiled | | EntryHandler.Linux.cs | [x] | **FIXED 2026-01-01** - Added CharacterSpacing/ClearButtonVisibility/VerticalTextAlignment, fixed namespace, null checks | | FlexLayoutHandler.cs | [ ] | NEEDS VERIFICATION | @@ -31,8 +31,8 @@ | GtkWebViewManager.cs | [ ] | NEEDS VERIFICATION | | GtkWebViewPlatformView.cs | [ ] | NEEDS VERIFICATION | | GtkWebViewProxy.cs | [x] | Added new file from decompiled | -| ImageButtonHandler.cs | [ ] | NEEDS VERIFICATION | -| ImageHandler.cs | [ ] | NEEDS VERIFICATION | +| ImageButtonHandler.cs | [x] | **VERIFIED 2026-01-01** - Matches production, has ImageSourceServiceResultManager | +| ImageHandler.Linux.cs | [x] | **VERIFIED 2026-01-01** - Matches production, FontImageSource rendering | | ItemsViewHandler.cs | [ ] | NEEDS VERIFICATION | | LabelHandler.Linux.cs | [x] | **FIXED 2026-01-01** - Added CharacterSpacing/LayoutAlignment/FormattedText, ConnectHandler gesture logic, fixed namespace | | LayoutHandler.cs | [ ] | NEEDS VERIFICATION | @@ -40,15 +40,15 @@ | PageHandler.cs | [ ] | NEEDS VERIFICATION | | PickerHandler.Linux.cs | [x] | **CREATED 2026-01-01** - Was missing, created from decompiled with collection changed tracking | | ProgressBarHandler.Linux.cs | [x] | **FIXED 2026-01-01** - Added ConnectHandler/DisconnectHandler IsVisible tracking, fixed namespace | -| RadioButtonHandler.cs | [ ] | NEEDS VERIFICATION | -| ScrollViewHandler.cs | [ ] | NEEDS VERIFICATION | -| SearchBarHandler.cs | [ ] | NEEDS VERIFICATION | +| RadioButtonHandler.Linux.cs | [x] | **VERIFIED 2026-01-01** - Matches production, Content/GroupName/Value in ConnectHandler | +| ScrollViewHandler.Linux.cs | [x] | **VERIFIED 2026-01-01** - Matches production, CommandMapper with RequestScrollTo | +| SearchBarHandler.Linux.cs | [x] | **FIXED 2026-01-01** - Fixed namespace, added CancelButtonColor, SolidPaint, null checks | | ShellHandler.cs | [ ] | NEEDS VERIFICATION | | SliderHandler.Linux.cs | [x] | **FIXED 2026-01-01** - Removed BackgroundColor (use base), fixed namespace, added ConnectHandler init calls | -| StepperHandler.cs | [ ] | NEEDS VERIFICATION | +| StepperHandler.Linux.cs | [x] | **VERIFIED 2026-01-01** - Matches production, dark theme support | | SwitchHandler.Linux.cs | [x] | **FIXED 2026-01-01** - Added OffTrackColor logic, fixed namespace, removed extra BackgroundColor | | TabbedPageHandler.cs | [ ] | NEEDS VERIFICATION | -| TimePickerHandler.cs | [ ] | NEEDS VERIFICATION | +| TimePickerHandler.cs | [x] | **VERIFIED 2026-01-01** - Matches production, dark theme support | | WebViewHandler.cs | [ ] | NEEDS VERIFICATION | | WindowHandler.cs | [ ] | NEEDS VERIFICATION |