Skip to content

Commit

Permalink
Inset for section
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamilarasan-Paranthaman committed Nov 18, 2024
1 parent ac2db27 commit d0d9a53
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,8 @@ internal UIEdgeInsets GetInsetForSection(ItemsViewLayout itemsViewLayout,
top += spacing;
}

// If we're at the last section, we don't need to add the right inset
var resolvedRightInset = section >= (collectionView.NumberOfSections() - 1) ? 0 : uIEdgeInsets.Right;

return new UIEdgeInsets(top, left,
uIEdgeInsets.Bottom, resolvedRightInset);
uIEdgeInsets.Bottom, uIEdgeInsets.Right);
}

// These measurement methods are only necessary for iOS 10 and lower
Expand Down
6 changes: 6 additions & 0 deletions src/Controls/src/Core/Handlers/Items/iOS/ItemsViewLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ internal void SetInitialConstraints(CGSize size)
public virtual UIEdgeInsets GetInsetForSection(UICollectionView collectionView, UICollectionViewLayout layout,
nint section)
{
// If we're at the last section, we don't need to add the right inset
if (section >= (collectionView.NumberOfSections() - 1))
{
return UIEdgeInsets.Zero;
}

if (_itemsLayout is GridItemsLayout gridItemsLayout)
{
if (ScrollDirection == UICollectionViewScrollDirection.Horizontal)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !MACCATALYST && !WINDOWS
#if !WINDOWS
// https://github.com/dotnet/maui/issues/11320
// Item spacing on the Windows platform is currently not functioning correctly
using NUnit.Framework;
Expand Down

0 comments on commit d0d9a53

Please sign in to comment.