显示小吃条抖动后导航器弹出

时间:2020-06-25 13:39:30

标签: flutter flutter-layout flutter-animation flutter-web flutter-test

我想在SnackBar终止后弹出屏幕。

怎么办?

Scaffold.of(context).showSnackBar(
                  SnackBar(
                    backgroundColor: Colors.pink,
                    content: Text('Successfull !'),
                    duration: Duration(seconds: 5),
                  ),
                );
                Navigator.of(context).pop();

1 个答案:

答案 0 :(得分:2)

使用closed then

SnackBarClosedReason

Scaffold.of(context).showSnackBar(
  SnackBar(
    backgroundColor: Colors.pink,
    content: Text('Successfull !'),
    duration: Duration(seconds: 5),
  ),
).closed.then((SnackBarClosedReason reason) {
  Navigator.of(context).pop();
});