Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -977,16 +977,27 @@ internal static void SetFlyoutLeftBarButton(UIViewController containerController
{
var icon = result?.Value;
var originalImageSize = icon?.Size ?? CGSize.Empty;
// Referred from the default hamburger size
var defaultIconHeight = 23f;
var defaultIconWidth = 23f;

// The largest height you can use for navigation bar icons in iOS.
// Per Apple's Human Interface Guidelines, the navigation bar height is 44 points,
// so using the full height ensures maximum visual clarity and maintains consistency
// with iOS design standards. This allows icons to utilize the entire available
// vertical space within the navigation bar container.
var defaultIconHeight = 44f;
var buffer = 0.1;
// We only check height because the navigation bar constrains vertical space (44pt height),
// but allows horizontal flexibility. Width can vary based on icon design and content,
// while height must fit within the fixed navigation bar bounds to avoid clipping.

// if the image is bigger than the default available size, resize it
if (icon is not null)
{
if (originalImageSize.Height - defaultIconHeight > buffer || originalImageSize.Width - defaultIconWidth > buffer)
if (originalImageSize.Height - defaultIconHeight > buffer)
{
icon = icon.ResizeImageSource(defaultIconWidth, defaultIconHeight, originalImageSize);
if (FlyoutPage.Flyout.IconImageSource is not FontImageSource fontImageSource || !fontImageSource.IsSet(FontImageSource.SizeProperty))
{
icon = icon.ResizeImageSource(originalImageSize.Width, defaultIconHeight, originalImageSize);
}
}
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,26 @@ void UpdateLeftToolbarItems()
{
icon = result?.Value;
var originalImageSize = icon?.Size ?? CGSize.Empty;
// Referred from the default hamburger size
var defaultIconHeight = 23f;
var defaultIconWidth = 23f;

// The largest height you can use for navigation bar icons in iOS.
// Per Apple's Human Interface Guidelines, the navigation bar height is 44 points,
// so using the full height ensures maximum visual clarity and maintains consistency
// with iOS design standards. This allows icons to utilize the entire available
// vertical space within the navigation bar container.
var defaultIconHeight = 44f;
var buffer = 0.1;
// We only check height because the navigation bar constrains vertical space (44pt height),
// but allows horizontal flexibility. Width can vary based on icon design and content,
// while height must fit within the fixed navigation bar bounds to avoid clipping.

// if the image is bigger than the default available size, resize it

if (icon is not null && originalImageSize.Height - defaultIconHeight > buffer || originalImageSize.Width - defaultIconWidth > buffer)
if (icon is not null && originalImageSize.Height - defaultIconHeight > buffer)
{
icon = icon.ResizeImageSource(defaultIconWidth, defaultIconHeight, originalImageSize);
if (image is not FontImageSource fontImageSource || !fontImageSource.IsSet(FontImageSource.SizeProperty))
{
icon = icon.ResizeImageSource(originalImageSize.Width, defaultIconHeight, originalImageSize);
}
}
}
else if (String.IsNullOrWhiteSpace(text) && IsRootPage && _flyoutBehavior == FlyoutBehavior.Flyout)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading