【发布时间】:2023-03-16 13:00:02
【问题描述】:
假设每次我想向数据库发送数据,如何让它看起来像页面正在加载?
HashMap ApiParams1 = new HashMap<String, String>();
ApiParams1.putIfAbsent("email", () => _email.text);
ApiParams1.putIfAbsent("mobileno", () => _phonenumber.text);
initApi("http://xxxxxxxxx/xxxx",
ApiParams1)
.PostApi()
.then((response) {
var jsondecode = json.decode(response);
if (jsondecode["status"].toString() == "success") {
Fluttertoast.showToast(
msg: jsondecode["message"].toString(),
backgroundColor: Colors.green,
toastLength: Toast.LENGTH_LONG);
saveEmaildetails();
} else if (jsondecode["status"].toString() != "success") {
Fluttertoast.showToast(
msg: jsondecode["message"],
backgroundColor: Colors.red,
toastLength: Toast.LENGTH_LONG);
}
});
我希望当我单击提交按钮时,它会显示一些加载以通知用户他们正在将数据发送到数据库。我想确保用户不会多次单击按钮。
【问题讨论】: