LanarsInc/top-snackbar-flutter

[Feature request] Persisting snackbar

a7md0 opened this issue · 3 comments

a7md0 commented

I really liked the package (compared with showing Android styled snack bar)

I have a use case to show persisting messages until removed manually, something like "No internet connection" I want to keep the snack bar showing until the network state change.

What I tried:-

  1. I was able to change the displayDuration to const Duration(days: 365) which seems fine till now
  2. I was not able to override the default dismiss on click, where I want the snack bar to not be dismissible (even with adding my own onTap it is still dismissible with user clicks)
  3. I was not able to dismiss the widget programmatically after showing it (this may be related to #16)

Based on the use case above, I believe these features will most likely resolve it:-

  • Add bool isInfiniteDuration which default to false; However, when set to true it disables the dismiss completely.
  • Add bool isDismissible which default to true; However, when set to true the user clicks won't dismiss the snack bar
  • (I'm not sure if this is the best approach) Return the TopSnackBar widget with the showTopSnackBar and expose a public method to dismiss the widget
a7md0 commented

I'm willing to create PR for those, if the suggested features are designed correctly

Hi @a7md0

Yes, great idea!

It would be great if you will prepare a PR, we will look at it 100%

@a7md0
Implemented in version 1.1.1