0

Can the initial GetX snackbar's duration be updated once a user clicks it? E.g. After the user clicks on snackbar I would like to make it visible for additional x seconds.

  • @RandalSchwartz - thanks for the warning:) btw. do you know if such functionality would be possible using the standard Flutter snackbar? – mar2dev Jun 24 '22 at 06:42
  • @RandalSchwartz - so how to update duration when the snackbar is already visible? (e.g. to give the user more time to read the snackbar's message once he clicks on it) – mar2dev Jun 24 '22 at 20:28

1 Answers1

0

You should indicate the duration when you call the snackbar method. Something like this:

Get.snackbar(
        "Title",
        "Message",
        icon: const Icon(Icons.warning, color: Colors.white),
        snackPosition: SnackPosition.TOP,
        backgroundColor: Colors.red[200],
        maxWidth: 300,
        duration: const Duration(seconds: 5),
        );
Carlos Sandoval
  • 764
  • 1
  • 5
  • 16
  • The question is how to update duration when the snackbar is already visible? (e.g. to give user more time to read the snackbar's message once he clicks on it) – mar2dev Jun 24 '22 at 06:33