【发布时间】:2020-11-14 07:25:27
【问题描述】:
我正在使用 bloc 模式上传图片。我有一个监听状态 UploadSuccess 的 bloc 监听器。我想在监听器中调用两个方法,一个用来弹出路由,另一个用来显示一个snackbar:
if (state is UpLoadSuccess) {
RioHelpers.showSuccessFlushBar(context, "Document Uploaded!");
Navigator.pop(context);
}
调用其中一种方法可以正常工作。我可以弹出路线或显示小吃店,但不能同时显示。当这两种方法都存在时,什么都不会发生。如何调用这两种方法?
这是冲洗条:
static void showSuccessFlushBar(BuildContext context, String title) {
Flushbar(
duration: Duration(seconds: 3),
icon: Icon(
Icons.check,
color: Colors.white,
),
backgroundColor: RioColours.snackBarSuccess,
message: title,
flushbarStyle: FlushbarStyle.FLOATING,
margin: EdgeInsets.all(8),
borderRadius: 8,
)..show(context);
}
【问题讨论】:
标签: flutter flutter-bloc