-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dismiss before show other flashbar #7
Comments
I think you may need to manage it yourself: FlashController _previousController;
Future<T> toast<T>(BuildContext context, String message) async {
if (_previousController?.isDisposed == false) _previousController.dismiss();
_previousController = FlashController<T>(
context,
(context, controller) {
return Flash.dialog(
controller: controller,
alignment: const Alignment(0, 0.5),
margin: const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
borderRadius: const BorderRadius.all(Radius.circular(8.0)),
enableDrag: false,
backgroundColor: Colors.black87,
child: DefaultTextStyle(
style: const TextStyle(fontSize: 16.0, color: Colors.white),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
child: Text(message),
),
),
);
},
duration: const Duration(seconds: 3),
);
return _previousController.show();
} |
@sososdk: Thank a lot for this code. It's working now. |
Is there a way to make the flashbar fade in and out but across all screens, not just one screen? I used fade transition widget on the flashbar but its only fading on one screen (the screen that it is applied to) |
To check flashbar is dismissed you need to use slightly different way now:
|
I wonder if there's any way to dismiss the current flashbar (if it's showing)?
I don't want it to be stacked in each other.
The text was updated successfully, but these errors were encountered: