public MaterialTabViewItemTemplate()
        {
            _visualFeedback = new VisualFeedbackEffect();
            Effects.Add(_visualFeedback);

            RowSpacing = 0;

            HorizontalOptions = LayoutOptions.FillAndExpand;
            VerticalOptions   = LayoutOptions.FillAndExpand;

            RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Star
            });
            RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });

            _icon = new Image
            {
                Aspect            = Aspect.AspectFit,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(0, 6)
            };

            _text = new Label
            {
                FontSize          = Device.GetNamedSize(NamedSize.Medium, typeof(Label)),
                FontAttributes    = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(0, 6)
            };

            _badge = new BadgeView
            {
                PlacementTarget = _icon,
                Margin          = new Thickness(0)
            };

            Children.Add(_icon);
            Children.Add(_text);
            Children.Add(_badge);

            SetRow(_icon, 0);
            SetRow(_text, 1);
            SetRow(_badge, 0);
            SetRowSpan(_badge, 2);
        }
        public WindowsTabViewItemTemplate()
        {
            RowSpacing = 0;

            HorizontalOptions = LayoutOptions.FillAndExpand;
            VerticalOptions   = LayoutOptions.FillAndExpand;

            RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Star
            });
            RowDefinitions.Add(new RowDefinition {
                Height = GridLength.Auto
            });

            _icon = new Image
            {
                Aspect            = Aspect.AspectFit,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(0, 6, 0, 0)
            };

            _text = new Label
            {
                FontSize          = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(0, 6)
            };

            _badge = new BadgeView
            {
                HeightRequest     = 20,
                WidthRequest      = 20,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Start
            };

            Children.Add(_icon);
            Children.Add(_text);
            Children.Add(_badge);

            SetRow(_icon, 0);
            SetRow(_text, 1);
            SetRow(_badge, 0);
            SetRowSpan(_badge, 2);
        }
        public Task OnDisappering(BadgeView badgeView)
        {
            if (_translationY == null)
            {
                _translationY = badgeView.TranslationY;
            }

            var tcs = new TaskCompletionSource <bool>();

            var disapperingAnimation = new Animation();

            disapperingAnimation.WithConcurrent(
                (f) => badgeView.Opacity = f,
                1, 0);

            disapperingAnimation.WithConcurrent(
                (f) => badgeView.TranslationY = f,
                _translationY.Value, _translationY.Value + Offset);

            disapperingAnimation.Commit(badgeView, nameof(OnAppearing), length: AnimationLength,
                                        finished: (v, t) => tcs.SetResult(true));

            return(tcs.Task);
        }