【发布时间】:2020-11-14 19:21:05
【问题描述】:
我使用 Firebase 制作了一个 Flutter 聊天应用。
我正在使用流构建器收听消息。我的聊天应用的另一个特点是,当用户长按他的聊天消息时,该消息会被删除。
我想显示已删除消息的弹出动画,因为现在消息被突然删除。
【问题讨论】:
我使用 Firebase 制作了一个 Flutter 聊天应用。
我正在使用流构建器收听消息。我的聊天应用的另一个特点是,当用户长按他的聊天消息时,该消息会被删除。
我想显示已删除消息的弹出动画,因为现在消息被突然删除。
【问题讨论】:
您可以为此使用显示对话框。
void _showDialog() {
// flutter defined function
showDialog(
context: context,
builder: (BuildContext context) {
// return object of type Dialog
return AlertDialog(
content: new Text("Are you sure you want to delete?"),
actions: <Widget>[
// usually buttons at the bottom of the dialog
FlatButton(
child: new Text("Delete"),
onPressed: () {
// Your deleteMessage method!
},
),
FlatButton(
child: new Text("Close"),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}
您可以从official document 了解更多信息。
【讨论】:
您需要的是动画小部件,我不知道您需要什么样的动画或如何使用它,但制作它的最佳方法是观看或阅读来自flutter official doc 的动画小部件
【讨论】: