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

패키지 상세v0.7.0

flutter_displaymode

안드로이드 플랫폼에서 디스플레이 모드(해상도, 리프레시 레이트)를 설정하기 위한 플러터 플러그인입니다. 지원되는 장치에서 고 리프레시 레이트를 활성화할 수 있습니다.

Android
30일 다운로드
13만
좋아요
220
Pub 점수
160

패키지 설치

flutter pub add flutter_displaymode

패키지 개요

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

flutter_displaymode는 Android 기기에서 해상도 및 리프레시 레이트와 같은 디스플레이 모드를 프로그래밍 방식으로 설정할 수 있도록 해주는 Flutter 플러그인입니다. 지원되는 하드웨어에서 고리프레시 레이트를 활성화함으로써 성능과 시각적 품질을 최적화하는 데 특히 유용합니다. 이 플러그인은 Android의 디스플레이 설정에 직접 액세스할 수 있게 해주며, 앱이 장치의 기능에 따라 동적으로 적응할 수 있도록 합니다. 이 기능은 플랫폼 전용이므로 iOS는 지원하지 않습니다.

사용 사례

  • 고리프레시 레이트 화면에서 앱 성능 최적화
  • 게임 앱에 대해 90Hz 또는 120Hz 리프레시 레이트 활성화
  • 더 나은 시각적 명확성을 위한 화면 해상도 조정
  • 애니메이션 중심 애플리케이션에서 UI 부드러움 개선
  • 다양한 화면 구성에서의 표시 동작 테스트

주요 기능

  • Android 디스플레이 해상도 및 리프레시율 설정
  • 호환 장치에서 고 리프레시 레이트 모드를 지원합니다
  • 표시 모드 설정을 위한 간단한 API 제공
  • 안드로이드 전용
  • root 접근 권한이 필요하지 않습니다

적합한 대상

  • 안드로이드 게임 개발자
  • 고성능 UI 렌더링이 필요한 앱
  • 프리미엄 안드로이드 기기 타겟 개발자
  • 시각적 정확도에 초점을 맞춘 애플리케이션
  • 도구의 표시 기능 테스트

고려 사항

  • Android 장치에서만 작동합니다
  • 동적 디스플레이 모드 변경을 지원하는 장치가 필요합니다
  • 모든 Android 버전에서 작동하지 않을 수 있습니다
  • 변경 사항은 시스템 또는 사용자에 의해 되돌릴 수 있습니다
  • 특정 하드웨어 기능에 제한됨

원본 README

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

Flutter Display Mode

pub package

A Flutter plugin to set display mode in Android. This is useful to enable high refresh rate in devices with discrete framerates like 60Hz, 90Hz etc. This library is ineffective on devices with LTPO panels and iOS devices with ProMotion.

This library should be used as a temporary fix to #35162 until this API gets added to Flutter engine itself.

Getting Started

Add library to pubspec then and rebuild your app:

flutter pub add flutter_displaymode
Set to highest/lowest framerate

Use helper functions FlutterDisplayMode.setHighRefreshRate or FlutterDisplayMode.setLowRefreshRate to switch to highest or lowest refresh rate maintaining current resolution.

// current: #1 1440x3120 @ 60Hz
// new: #2 1440x3120 @ 90Hz
await FlutterDisplayMode.setHighRefreshRate();

// current: #2 1440x3120 @ 90Hz
// new: #1 1440x3120 @ 60Hz
await FlutterDisplayMode.setLowRefreshRate();
Get supported modes

FlutterDisplayMode.supported returns all the modes that can be set as the preferred mode. This always returns DisplayMode.auto as one of the modes.

import 'package:flutter_displaymode/flutter_displaymode.dart';

try {
  modes = await FlutterDisplayMode.supported;
  modes.forEach(print);

  /// On OnePlus 7 Pro:
  /// #0 0x0 @0Hz // Automatic
  /// #1 1080x2340 @ 60Hz
  /// #2 1080x2340 @ 90Hz
  /// #3 1440x3120 @ 90Hz
  /// #4 1440x3120 @ 60Hz

  /// On OnePlus 8 Pro:
  /// #0 0x0 @0Hz // Automatic
  /// #1 1080x2376 @ 60Hz
  /// #2 1440x3168 @ 120Hz
  /// #3 1440x3168 @ 60Hz
  /// #4 1080x2376 @ 120Hz
} on PlatformException catch (e) {
  /// e.code =>
  /// noAPI - No API support. Only Marshmallow and above.
  /// noActivity - Activity is not available. Probably app is in background
}
Get active mode

FlutterDisplayMode.active fetches the currently active mode. This is not always the preferred mode set by FlutterDisplayMode.setPreferredMode. It can be altered by the system based on the display settings.

final DisplayMode m = await FlutterDisplayMode.active;
Set preferred mode

FlutterDisplayMode.setPreferredMode changes the preferred mode. It is upto the system to use this mode. Sometimes system can choose not switch to this based on internal heuristics. Check FlutterDisplayMode.active to see if it actually switches.

/// This setting is per session. 
/// Please ensure this was placed with `initState` of your root widget.
await FlutterDisplayMode.setPreferredMode(modes[1]);
Get preferred mode

FlutterDisplayMode.preferred returns the currently preferred mode. If not manually set with FlutterDisplayMode.setPreferredMode then it will be DisplayMode.auto.

final DisplayMode m = await FlutterDisplayMode.preferred;

You can check out a complete example here.

카테고리

소스 저장소

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