private static async Task MoveToSide(CustomPageAnimation leftPage, CustomPageAnimation rightPage, bool goingForward)
        {
            // Clear the background colors
            Color pageBackgroundColor = rightPage.Page.BackgroundColor;

            rightPage.Page.BackgroundColor = Color.Transparent;
            Color pageRootBackgroundColor = rightPage.PageRootCache.View.BackgroundColor;

            rightPage.PageRootCache.View.BackgroundColor = Color.Transparent;

            // Hide the footer
            double opacity = rightPage.PageFooter.Opacity;

            rightPage.PageFooter.Opacity = 0;

            // Animate
            await Task.WhenAll(leftPage.MoveToSide(false, !goingForward), rightPage.MoveToSide(true, goingForward));

            // Restore the footer
            rightPage.PageFooter.Opacity = opacity;

            // Restore the background colors
            rightPage.Page.BackgroundColor = pageBackgroundColor;
            rightPage.PageRootCache.View.BackgroundColor = pageRootBackgroundColor;
        }
        public void Preparing(View _, PopupPage page)
        {
            // Get the previous page's animation
            IReadOnlyList <PopupPage> stack = PopupNavigation.Instance.PopupStack;

            PreviousPageAnimation = stack.Count > 1 ? stack[stack.Count - 2]?.Animation as CustomPageAnimation : null;

            // Create the caches
            Page = page as CustomPage;
            CreateCaches();

            // Get the footer element
            PageFooter = Page.GetTemplateChild("PageFooter") as View;

            // Hide the page
            Page.IsVisible = false;
        }
Esempio n. 3
0
 public CustomPage(bool showTopMargin = false, LayoutAlignment footerLogoHorizontalOptions = LayoutAlignment.Start, bool showMinimumContents = false, double topMargin = -1, int cornersRadius = 0)
 {
     Animation = new CustomPageAnimation();
     if (!showTopMargin)
     {
         BackgroundColor = Color.Transparent;
     }
     ShowTopMargin = showTopMargin;
     FooterLogoHorizontalOptions = footerLogoHorizontalOptions;
     ShowMinimumContents         = showMinimumContents;
     CornersRadius = cornersRadius;
     if (topMargin > 0)
     {
         TopMargin = topMargin;
     }
     if (Device.RuntimePlatform == Device.iOS)
     {
         HasSystemPadding = false;
     }
 }