Reputation: 7156
I used snackbar from another_flushbar
package.
Flushbar(
title: "Title",
message: 'some message here',
duration: Duration(seconds: 3),
flushbarPosition: FlushbarPosition.TOP,
)..show(context);
How to hide it on tap? There is a callback that registers the user's click anywhere.
final OnTap? onTap;
Upvotes: 0
Views: 627
Reputation: 12575
Try with the inkWell
or GestureDetector
Inkwell(
onTap:(){
Navigator.of(context).pop();
},
child: Flushbar(
title: "Title",
message: 'some message here',
duration: Duration(seconds: 3),
flushbarPosition: FlushbarPosition.TOP,
)..show(context),
);
you can also try with mainButton
Flushbar(
title: "Title",
message: 'some message here',
duration: Duration(seconds: 3),
flushbarPosition: FlushbarPosition.TOP,
mainButton: FlatButton(
onPressed: () {
flush.dismiss(true); // result = true
},
child: Text(
"Dismiss",
style: TextStyle(color: Colors.amber),
),
),
)..show(context);
Upvotes: 1