SafeAreaEffect
using System;
using System.Linq;
using Xamarin.CommunityToolkit.Helpers;
using Xamarin.Forms;
namespace Xamarin.CommunityToolkit.Effects
{
public static class SafeAreaEffect
{
public static readonly BindableProperty SafeAreaProperty = BindableProperty.CreateAttached("SafeArea", typeof(SafeArea), typeof(SafeAreaEffect), (object)default(SafeArea), 2, null, new BindingPropertyChangedDelegate((object)null, (IntPtr)(void*)), null, null, null);
public static SafeArea GetSafeArea(BindableObject view)
{
return (SafeArea)view.GetValue(SafeAreaProperty);
}
public static void SetSafeArea(BindableObject view, SafeArea value)
{
view.SetValue(SafeAreaProperty, (object)value);
}
private static void OnSafeAreaChanged(BindableObject bindable, object oldValue, object newValue)
{
View val = bindable as View;
if (val != null) {
Effect val2 = val.get_Effects().FirstOrDefault((Effect e) => e is SafeAreaEffectRouter);
if (val2 != null)
val.get_Effects().Remove(val2);
if (!((SafeArea)newValue).IsEmpty)
val.get_Effects().Add(new SafeAreaEffectRouter());
}
}
}
}