JulyWitch / animated_snack_bar

Easily show beautiful snack bars directly using overlays. Create custom snack bars and show them with awesome animations.
https://pub.dev/packages/animated_snack_bar
GNU General Public License v3.0
16 stars 12 forks source link

clean snack bar #13

Closed pmella16 closed 10 months ago

pmella16 commented 1 year ago

Hi, i need clean the navbar when i navigate to other page, i add this class to animated_snack_bar.dart `class ClearAll { clean() {

final index = _snackBars.indexWhere(
  (element) => element.info.key.currentContext != null,
);

 if (index != -1) {

  _snackBars.removeWhere();
 }

} } `

and work fine, i call the method ClearAll().clean(); when i am in the new page, but i think you can made this better

JulyWitch commented 10 months ago

Thank you for your suggestion, I'll add such a behavior in the next release

JulyWitch commented 10 months ago

Dear @pmella16 I've added a new functionality in v0.4.0 That you can use to manually remove all snack bars

AnimatedSnackBar.removeAll();

Please open a new issue if you notice any weird behavior Thanks