我想在用户未与应用程序交互一段特定时间后注销用户。
我已将整个子小部件包装在GestureDetector()
.
请建议这是否是执行此操作的最佳优化方法。
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new GestureDetector(
onTap: () {
// duration reset's to a specific time
startTimeout([int milliseconds]) { return new Timer(duration, handleTimeout); }
},
child: new HomeWidget(),);
}
void handleTimeOut {
// Log User Out
}
}
Run Code Online (Sandbox Code Playgroud)