Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev7.0.0

keep_screen_on

Este plugin desativa o desligamento automático da tela e impede que a tela seja desligada.

AndroidiOS
Downloads em 30 dias
29,6 mil
Curtidas
54
Pontos Pub
160

Instalar pacote

flutter pub add keep_screen_on

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

O pacote keep_screen_on evita que a tela do dispositivo desligue automaticamente, garantindo visibilidade contínua da exibição. É ideal para aplicativos que exigem atividade de tela ininterrupta, como reprodutores de vídeo, aplicativos de navegação ou modos quiosque. Disponível para Android e iOS, integra-se perfeitamente aos projetos Flutter por meio de um simples comando de adição. O plugin funciona mantendo um bloqueio de despertar no dispositivo, mantendo o brilho da tela e a atividade. É leve e projetado para implementação direta sem configurações complexas.

Casos de uso

  • Reprodução de vídeo
  • Aplicativos de navegação
  • Modo quiosque
  • Ferramentas de apresentação
  • Tarefas de longa duração

Principais recursos

  • Evita o escurecimento automático da tela
  • Plataforma cruzada (Android e iOS)
  • Integração simples
  • Configuração mínima
  • Gerenciamento de bloqueio de despertar

Indicado para

  • Aplicações de mídia
  • Exibições interativas
  • Ferramentas de serviço em campo
  • Sinalização digital
  • fluxos de trabalho sensíveis ao tempo

Considerações

  • Aumento no consumo da bateria
  • Requer permissão do usuário em alguns dispositivos
  • Não adequado para operações em segundo plano
  • Pode entrar em conflito com os recursos de economia de energia do sistema
  • Controle limitado sobre o brilho da tela

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

KeepScreenOn

This plugin disables automatic screen off and prevents the screen from turning off.

Getting Started

Add this to your package's pubspec.yaml file:

dependencies:
  keep_screen_on: ^6.0.0

Usage

Import KeepScreenOn.

import 'package:keep_screen_on/keep_screen_on.dart';

To keep the screen from turning off, call the turnOn method of the KeepScreenOn class.

// Keep the screen on.
KeepScreenOn.turnOn();

Calling the turnOff method of the KeepScreenOn class will restore the screen to turn off automatically.
Alternatively, you can do the same by specifying false as the argument to the turnOn method.

// Reset
KeepScreenOn.turnOff();

// or...
KeepScreenOn.turnOn(on: false);

You can check if the screen is not turned off by checking the isOn property or isOff property.
Since isOn and isOff return Future <bool?>, you need to use "await" or receive the value with the "then" method.

Future<bool?> getScreenKeepOn() async {
  return await KeepScreenOn.isOn; 
}

Future<bool?> getScreenKeepOff() async {
  return await KeepScreenOn.isOff;
}
Android only.

The following functions are available on Android. Nothing happens even if you run it on an OS other than Android.

You can specify the withAllowLockWhileScreenOn argument to the turnOn and turnOff methods.
When withAllowLockWhileScreenOn: true is specified, FLAG_ALLOW_LOCK_WHILE_SCREEN_ON is also specified in addition to FLAG_KEEP_SCREEN_ON.

KeepScreenOn.turnOn(withAllowLockWhileScreenOn: true);

KeepScreenOn.turnOff(withAllowLockWhileScreenOn: true);

If you want to switch only FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, you can do so by calling the method below.

KeepScreenOn.addAllowLockWhileScreenOn();

KeepScreenOn.clearAllowLockWhileScreenOn();

You can check the assignment status of FLAG_ALLOW_LOCK_WHILE_SCREEN_ON from the isAllowLockWhileScreenOn property.

KeepScreenOn.isAllowLockWhileScreenOn

Each call returns the following values on non-Android OS:

Method/Property Returns
addAllowLockWhileScreenOn false
clearAllowLockWhileScreenOn false
isAllowLockWhileScreenOn null

Attention

When you call the turnOn method with no arguments or with on: true,
Android sets android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON for the activity window as an internal action.
iOS sets UIApplication.shared.isIdleTimerDisabled to true.

For this reason, be sure to use the dispose method of StatefulWidget etc.

KeepScreenOn.turnOff();

Should be called. If you forget to call turnOff (or turnOn(on: false)), the screen will not turn off automatically while the app is running.

For Android, when the activity is switched, the automatic screen off will follow the activity to which it was switched.
For iOS, automatic screen off is restored when you move to the background.

Categorias

Dependências

Lista de dependências 1 itens

  • keep_screen_on_platform_interface^3.0.0

Repositório-fonte

Projetos que usam este pacote

Ainda não há dados.