【发布时间】:2020-07-28 14:43:09
【问题描述】:
有没有办法在函数执行时启动 5 秒或 X 秒的不活动计时器?
这是我正在做的事情:
我正在创建一个屏幕截图:
//todo: I need an activity timer [start] here
screenshotController.capture(
//delay: Duration(seconds: 5),
pixelRatio: 2,
path: newPath
).then((io.File image) {
//Capture Done
_imageFile = image;
}).catchError((onError) {
print(onError);
});
// todo: I need an activity timer [stop] here.
用户不能中断 PNG 文件的创建。我需要某种进度计时器来启动/停止。我不想使用 Progress_HUD。这是非常丑陋的。我试过了。我必须更改我的整个代码以适应这个应用程序的工作方式。
我倾向于使用 CircularProgress..().. 但我怎样才能让它开始呢?我怎样才能让它停下来??
我如何知道 screenshotController 何时仍处于活动状态?
【问题讨论】: