2026-01-01 06:22:48 -05:00
|
|
|
using System;
|
2025-12-19 09:30:16 +00:00
|
|
|
using Microsoft.Maui.Handlers;
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.Maui.Platform.Linux.Handlers;
|
|
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
public class FlyoutPageHandler : ViewHandler<IFlyoutView, SkiaFlyoutPage>
|
2025-12-19 09:30:16 +00:00
|
|
|
{
|
2026-01-01 06:22:48 -05:00
|
|
|
public static IPropertyMapper<IFlyoutView, FlyoutPageHandler> Mapper = (IPropertyMapper<IFlyoutView, FlyoutPageHandler>)(object)new PropertyMapper<IFlyoutView, FlyoutPageHandler>((IPropertyMapper[])(object)new IPropertyMapper[1] { (IPropertyMapper)ViewHandler.ViewMapper })
|
|
|
|
|
{
|
|
|
|
|
["IsPresented"] = MapIsPresented,
|
|
|
|
|
["FlyoutWidth"] = MapFlyoutWidth,
|
|
|
|
|
["IsGestureEnabled"] = MapIsGestureEnabled,
|
|
|
|
|
["FlyoutBehavior"] = MapFlyoutBehavior
|
|
|
|
|
};
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
public static CommandMapper<IFlyoutView, FlyoutPageHandler> CommandMapper = new CommandMapper<IFlyoutView, FlyoutPageHandler>((CommandMapper)(object)ViewHandler.ViewCommandMapper);
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
public FlyoutPageHandler()
|
|
|
|
|
: base((IPropertyMapper)(object)Mapper, (CommandMapper)(object)CommandMapper)
|
|
|
|
|
{
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
public FlyoutPageHandler(IPropertyMapper? mapper, CommandMapper? commandMapper = null)
|
|
|
|
|
: base((IPropertyMapper)(((object)mapper) ?? ((object)Mapper)), (CommandMapper)(((object)commandMapper) ?? ((object)CommandMapper)))
|
|
|
|
|
{
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
protected override SkiaFlyoutPage CreatePlatformView()
|
|
|
|
|
{
|
|
|
|
|
return new SkiaFlyoutPage();
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
protected override void ConnectHandler(SkiaFlyoutPage platformView)
|
|
|
|
|
{
|
|
|
|
|
base.ConnectHandler(platformView);
|
|
|
|
|
platformView.IsPresentedChanged += OnIsPresentedChanged;
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
protected override void DisconnectHandler(SkiaFlyoutPage platformView)
|
|
|
|
|
{
|
|
|
|
|
platformView.IsPresentedChanged -= OnIsPresentedChanged;
|
|
|
|
|
platformView.Flyout = null;
|
|
|
|
|
platformView.Detail = null;
|
|
|
|
|
base.DisconnectHandler(platformView);
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
private void OnIsPresentedChanged(object? sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
public static void MapIsPresented(FlyoutPageHandler handler, IFlyoutView flyoutView)
|
|
|
|
|
{
|
|
|
|
|
if (((ViewHandler<IFlyoutView, SkiaFlyoutPage>)(object)handler).PlatformView != null)
|
|
|
|
|
{
|
|
|
|
|
((ViewHandler<IFlyoutView, SkiaFlyoutPage>)(object)handler).PlatformView.IsPresented = flyoutView.IsPresented;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
public static void MapFlyoutWidth(FlyoutPageHandler handler, IFlyoutView flyoutView)
|
|
|
|
|
{
|
|
|
|
|
if (((ViewHandler<IFlyoutView, SkiaFlyoutPage>)(object)handler).PlatformView != null)
|
|
|
|
|
{
|
|
|
|
|
((ViewHandler<IFlyoutView, SkiaFlyoutPage>)(object)handler).PlatformView.FlyoutWidth = (float)flyoutView.FlyoutWidth;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
public static void MapIsGestureEnabled(FlyoutPageHandler handler, IFlyoutView flyoutView)
|
|
|
|
|
{
|
|
|
|
|
if (((ViewHandler<IFlyoutView, SkiaFlyoutPage>)(object)handler).PlatformView != null)
|
|
|
|
|
{
|
|
|
|
|
((ViewHandler<IFlyoutView, SkiaFlyoutPage>)(object)handler).PlatformView.GestureEnabled = flyoutView.IsGestureEnabled;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
|
2026-01-01 06:22:48 -05:00
|
|
|
public static void MapFlyoutBehavior(FlyoutPageHandler handler, IFlyoutView flyoutView)
|
|
|
|
|
{
|
|
|
|
|
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
|
|
|
|
|
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
|
|
|
|
|
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
|
|
|
|
|
//IL_0029: Expected I4, but got Unknown
|
|
|
|
|
if (((ViewHandler<IFlyoutView, SkiaFlyoutPage>)(object)handler).PlatformView != null)
|
|
|
|
|
{
|
|
|
|
|
SkiaFlyoutPage platformView = ((ViewHandler<IFlyoutView, SkiaFlyoutPage>)(object)handler).PlatformView;
|
|
|
|
|
FlyoutBehavior flyoutBehavior = flyoutView.FlyoutBehavior;
|
|
|
|
|
platformView.FlyoutLayoutBehavior = (int)flyoutBehavior switch
|
|
|
|
|
{
|
|
|
|
|
0 => FlyoutLayoutBehavior.Default,
|
|
|
|
|
1 => FlyoutLayoutBehavior.Popover,
|
|
|
|
|
2 => FlyoutLayoutBehavior.Split,
|
|
|
|
|
_ => FlyoutLayoutBehavior.Default,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-19 09:30:16 +00:00
|
|
|
}
|