version up

This commit is contained in:
2023-07-31 17:11:39 +08:00
parent befbc7fc9b
commit 8419c9d389
41 changed files with 1053 additions and 286 deletions

View File

@ -0,0 +1,39 @@
using Microsoft.Maui.Platform;
using UIKit;
namespace Blahblah.FlowerApp;
public static partial class PageExtensions
{
public static UIViewController ShowBottomSheet(this Page page, IView content, bool dimDismiss = false)
{
var mauiContext = page.Handler?.MauiContext ?? throw new Exception("MauiContext is null");
var viewController = page.ToUIViewController(mauiContext);
var viewControllerToPresent = content.ToUIViewController(mauiContext);
viewControllerToPresent.ModalInPresentation = !dimDismiss;
var sheet = viewControllerToPresent.SheetPresentationController;
if (sheet != null)
{
sheet.Detents = new[]
{
UISheetPresentationControllerDetent.CreateLargeDetent()
};
//sheet.LargestUndimmedDetentIdentifier = dimDismiss ?
// UISheetPresentationControllerDetentIdentifier.Unknown :
// UISheetPresentationControllerDetentIdentifier.Medium;
sheet.PrefersScrollingExpandsWhenScrolledToEdge = false;
sheet.PrefersEdgeAttachedInCompactHeight = true;
sheet.WidthFollowsPreferredContentSizeWhenEdgeAttached = true;
}
viewController.PresentViewController(viewControllerToPresent, true, null);
return viewControllerToPresent;
}
public static void CloseBottomSheet(this UIViewController sheet)
{
sheet.DismissViewController(true, null);
}
}