hideCurrentMaterialBanner method Null safety
- {MaterialBannerClosedReason reason = MaterialBannerClosedReason.hide}
Removes the current MaterialBanner by running its normal exit animation.
The closed completer is called after the animation is complete.
Implementation
void hideCurrentMaterialBanner({ MaterialBannerClosedReason reason = MaterialBannerClosedReason.hide }) {
assert(reason != null);
if (_materialBanners.isEmpty || _materialBannerController!.status == AnimationStatus.dismissed) {
return;
}
final Completer<MaterialBannerClosedReason> completer = _materialBanners.first._completer;
if (_accessibleNavigation!) {
_materialBannerController!.value = 0.0;
completer.complete(reason);
} else {
_materialBannerController!.reverse().then<void>((void value) {
assert(mounted);
if (!completer.isCompleted) {
completer.complete(reason);
}
});
}
}