是否有任何方法可以根据条件打开一个带有选择列表的警报对话框?
因此,基本上我有一个倒计时计时器一分钟,当分钟完成时,我希望一个警报对话框在屏幕上弹出用户:
if (isCompleted) {
//open the dialog widget here
}
我找不到解决方案。我只找到可以在按钮上打开对话框的解决方案。 谁能帮忙?
So basically I have a countdown timer for a minute and when the minute finishes I want an alert dialog to pop on the screen for the user e.g:
if (isCompleted) {
//open the dialog widget here
}
I can't find solutions for that. I'm only finding solutions that opens the dialog on button press.
Can anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在第一次打开应用程序时在我的项目中使用此信息来显示信息对话框:
您可能可以将小部件包装在
futurebuilder
中(因此您可以访问context )将您的倒计时作为
future
参数,并且,当倒计时结束时,您可以从那里调用showdialog
。I used this in a project of mine to display an info dialog when opening the app for the first time:
You can probably wrap your widgets in a
FutureBuilder
(so you have access tocontext
) with your countdown as thefuture
argument, and, when the countdown is over, you can callshowDialog
from there.