Skip to content

Commit

Permalink
Match Catalyst Template to iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWeen committed Oct 2, 2024
1 parent 2fac3dc commit e3a3cf1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Controls/src/Core/Shell/BaseShellItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
IgnoreSafeArea = true
};

if (DeviceInfo.Platform == DevicePlatform.WinUI)
if (OperatingSystem.IsWindows())
grid.ColumnSpacing = grid.RowSpacing = 0;

grid.Resources = new ResourceDictionary();
Expand Down Expand Up @@ -406,19 +406,19 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str

defaultGridClass.Setters.Add(new Setter { Property = VisualStateManager.VisualStateGroupsProperty, Value = groups });

if (DeviceInfo.Platform == DevicePlatform.Android)
if (OperatingSystem.IsAndroid())
defaultGridClass.Setters.Add(new Setter { Property = Grid.HeightRequestProperty, Value = 50 });
else
defaultGridClass.Setters.Add(new Setter { Property = Grid.HeightRequestProperty, Value = 44 });


ColumnDefinitionCollection columnDefinitions = new ColumnDefinitionCollection();

if (DeviceInfo.Platform == DevicePlatform.Android)
if (OperatingSystem.IsAndroid())
columnDefinitions.Add(new ColumnDefinition { Width = 54 });
else if (DeviceInfo.Platform == DevicePlatform.iOS)
else if (OperatingSystem.IsIOS() || OperatingSystem.IsMacCatalyst())
columnDefinitions.Add(new ColumnDefinition { Width = 50 });
else if (DeviceInfo.Platform == DevicePlatform.WinUI)
else if (OperatingSystem.IsWindows())
columnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
else if (DeviceInfo.Platform == DevicePlatform.Tizen)
columnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
Expand All @@ -432,11 +432,11 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
var image = new Image();

double sizeRequest = -1;
if (DeviceInfo.Platform == DevicePlatform.Android)
if (OperatingSystem.IsAndroid())
sizeRequest = 24;
else if (DeviceInfo.Platform == DevicePlatform.iOS)
else if (OperatingSystem.IsIOS() || OperatingSystem.IsMacCatalyst())
sizeRequest = 22;
else if (DeviceInfo.Platform == DevicePlatform.WinUI)
else if (OperatingSystem.IsWindows())
sizeRequest = 16;
else if (DeviceInfo.Platform == DevicePlatform.Tizen)
sizeRequest = 25;
Expand All @@ -447,7 +447,7 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
defaultImageClass.Setters.Add(new Setter() { Property = Image.WidthRequestProperty, Value = sizeRequest });
}

if (DeviceInfo.Platform == DevicePlatform.WinUI)
if (OperatingSystem.IsWindows())
{
defaultImageClass.Setters.Add(new Setter { Property = Image.HorizontalOptionsProperty, Value = LayoutOptions.Start });
defaultImageClass.Setters.Add(new Setter { Property = Image.MarginProperty, Value = new Thickness(12, 0, 12, 0) });
Expand All @@ -464,7 +464,7 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str

grid.Add(label, 1, 0);

if (DeviceInfo.Platform == DevicePlatform.Android)
if (OperatingSystem.IsAndroid())
{
object textColor;

Expand All @@ -482,12 +482,12 @@ internal static DataTemplate CreateDefaultFlyoutItemCell(string textBinding, str
defaultLabelClass.Setters.Add(new Setter { Property = Label.FontFamilyProperty, Value = "sans-serif-medium" });
defaultLabelClass.Setters.Add(new Setter { Property = Label.MarginProperty, Value = new Thickness(20, 0, 0, 0) });
}
else if (DeviceInfo.Platform == DevicePlatform.iOS)
else if (OperatingSystem.IsIOS() || OperatingSystem.IsMacCatalyst())
{
defaultLabelClass.Setters.Add(new Setter { Property = Label.FontSizeProperty, Value = 14 });
defaultLabelClass.Setters.Add(new Setter { Property = Label.FontAttributesProperty, Value = FontAttributes.Bold });
}
else if (DeviceInfo.Platform == DevicePlatform.WinUI)
else if (OperatingSystem.IsWindows())
{
defaultLabelClass.Setters.Add(new Setter { Property = Label.HorizontalOptionsProperty, Value = LayoutOptions.Start });
defaultLabelClass.Setters.Add(new Setter { Property = Label.HorizontalTextAlignmentProperty, Value = TextAlignment.Start });
Expand Down

0 comments on commit e3a3cf1

Please sign in to comment.