如何使应用程序保持扑朔迷离? [英] How to keep application awake in flutter?
本文介绍了如何使应用程序保持扑朔迷离?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何防止应用程序将屏幕锁定在抖动状态?
How to keep an application from locking the screen in flutter?
是否有标记将其关闭? Flutter SDK会公开吗?
Is there a flag to turn it off an on? Does flutter SDK expose this?
类似于keepAwake(true);
谢谢
推荐答案
作为对屏幕插件的支持提到的 @Tree 已停产,并且现在存在一些问题,您可以使用
As support for the screen plugin that @Tree mentioned has been discontinued and there are some issues with it now, you can use wakelock
.
Full disclosure: I am the author of this plugin, however, it is basically a port of the wakelock functionality from the screen
plugin, with the issues fixed:
import 'package:wakelock/wakelock.dart';
// To keep the screen on:
Wakelock.enable(); // or Wakelock.toggle(on: true);
// To let the screen turn off again:
Wakelock.disable(); // or Wakelock.toggle(on: false);
这篇关于如何使应用程序保持扑朔迷离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文