패키지, 저장소 및 앱 카테고리 검색

패키지 상세v7.0.0

keep_screen_on

이 플러그인은 자동 화면 꺼짐을 비활성화하고 화면이 꺼지는 것을 방지합니다.

AndroidiOS
30일 다운로드
3만
좋아요
54
Pub 점수
160

패키지 설치

flutter pub add keep_screen_on

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

keep_screen_on 패키지는 장치 화면이 자동으로 꺼지지 않도록 하여 지속적인 표시 가시성을 보장합니다. 비디오 플레이어, 내비게이션 앱 또는 키오스크 모드와 같이 화면 활동을 끊김 없이 유지해야 하는 애플리케이션에 적합합니다. Android 및 iOS 모두에서 사용 가능하며, 간단한 추가 명령을 통해 Flutter 프로젝트에 원활하게 통합됩니다. 이 플러그인은 장치에서 웨이크락을 유지함으로써 작동하여 화면 밝기와 활동 상태를 유지합니다. 복잡한 구성 없이도 간편하게 구현할 수 있도록 가볍고 설계되었습니다.

사용 사례

  • 비디오 재생
  • 내비게이션 앱
  • 키오스크 모드
  • 프레젠테이션 도구
  • 장시간 실행 작업

주요 기능

  • 자동 화면 어두워짐 방지
  • 크로스 플랫폼(안드로이드 및 iOS)
  • 간단한 통합
  • 최소 구성
  • 웨이크 락 관리

적합한 대상

  • 미디어 애플리케이션
  • 인터랙티브 디스플레이
  • 현장 서비스 도구
  • 디지털 사인
  • 시간 민감성 워크플로우

고려 사항

  • 배터리 소모 증가
  • 일부 기기에서는 사용자 권한이 필요합니다
  • 백그라운드 작업에 적합하지 않습니다
  • 시스템 전력 절약 기능과 충돌할 수 있습니다
  • 화면 밝기 조절에 제한이 있음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

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.

카테고리

의존성

의존성 목록 1 개

  • keep_screen_on_platform_interface^3.0.0

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.