示例#1
0
        private void TransitionTo(SnackbarState state)
        {
            StopTimer();
            State.SnackbarState = state;
            var options = State.Options;

            if (state.IsShowing())
            {
                if (options.ShowTransitionDuration <= 0)
                {
                    TransitionTo(SnackbarState.Visible);
                }
                else
                {
                    StartTimer(options.ShowTransitionDuration);
                }
            }
            else if (state.IsVisible() && !options.RequireInteraction)
            {
                if (options.VisibleStateDuration <= 0)
                {
                    TransitionTo(SnackbarState.Hiding);
                }
                else
                {
                    StartTimer(options.VisibleStateDuration);
                }
            }
            else if (state.IsHiding())
            {
                if (options.HideTransitionDuration <= 0)
                {
                    OnClose?.Invoke(this);
                }
                else
                {
                    StartTimer(options.HideTransitionDuration);
                }
            }

            OnUpdate?.Invoke();
        }
示例#2
0
 public static bool IsVisible(this SnackbarState state) => state == SnackbarState.Visible;
示例#3
0
 public static bool IsHiding(this SnackbarState state) => state == SnackbarState.Hiding;
示例#4
0
 public static bool IsShowing(this SnackbarState state) => state == SnackbarState.Showing;