SnackBar

  • Description

      SnackBar

      SnackBar is a new type of notification. A snackbar should be used to show feedback about an operation performed by the user. This is similar to a toast in the sense that it appears on the screen for a short period of time and then disappears automatically. Although it also presents some important differences, for example, Snackbar contains an action text button.
      In this component we can create two types of SnackBar:

      Simple SnackBar

      Advanced SnackBar

  • Events

    • On click Advanced SnackBar
    • Event that is executed when we click on the action text of the Advanced Snackbar
  • Procedures

    • Simple SnackBar
    • This method creates a simple snackBar. In it we can add a message and the duration. This will indicate the time that the SnackBar will be displayed on the screen.
    • Advanced SnackBar
    • This method creates an advanced SnackBar. In it we can add a message, duration and a concrete action. We define this action in the event 'On click Advanced SnackBar'.
    • Set duration
    • These methods allow us to establish the duration of our SnackBar, we find three constant types:
    • - Duration short
    • - Duration Long
    • - Duration Infinite
    • In this method we must bear in mind, that if we establish it in a Simple SnackBar, the user can not cancel it.
  • Example

    • Simple SnackBar
    • Generating a SnackBar with this aspect.
    • Advanced SnackBar
    • Generating a SnackBar with this aspect.

    • Now let's configure a simple event, to explain the functionality of the advanced SnackBar.
    • Our screen contains an image that is hidden, with this event we will get that by clicking on the action of the advanced SnackBar, it becomes visible.