如何在flutter中实现浮动小吃店动画?

zqdjd7g9  于 2023-01-14  发布在  Flutter
关注(0)|答案(1)|浏览(145)

我正在尝试实现浮动Snackbar的动画,它从屏幕底部出现并向上移动,就像在Gmail应用程序中滑动邮件以获取成功时出现的动画一样。有人能举个例子吗?

ScaffoldMessenger.of(context).showSnackBar(SnackBar(
                          content: Text(
                            'Product removed from cart',
                          ),
                          action: SnackBarAction(
                              label: 'Undo',
                              onPressed: () {
                               //
                              }),
                          duration: Duration(seconds: 3),
                          behavior: SnackBarBehavior.floating,
                          margin: EdgeInsets.only(bottom: 30,left: 10,right: 10),
                          animation: // **Answer Please**
                      }
pbossiut

pbossiut1#

导入“fluttertoast”包并按如下方式使用...

Fluttertoast.showToast(
        msg:"Toast Message",
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.BOTTOM,
        timeInSecForIosWeb: 1,
        textColor: Colors.white,
        backgroundColor: Colors.black54,
        fontSize: 16.0)

相关问题