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(); }
public static bool IsVisible(this SnackbarState state) => state == SnackbarState.Visible;
public static bool IsHiding(this SnackbarState state) => state == SnackbarState.Hiding;
public static bool IsShowing(this SnackbarState state) => state == SnackbarState.Showing;