All Projects → ajinasokan → flutter_displaymode

ajinasokan / flutter_displaymode

Licence: MIT license
A Flutter plugin to set display mode in Android

Programming Languages

dart
5743 projects
java
68154 projects - #9 most used programming language
ruby
36898 projects - #4 most used programming language
swift
15916 projects
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to flutter displaymode

barcode.flutter
barcode generate library for Flutter
Stars: ✭ 58 (-50.85%)
Mutual labels:  flutter-plugin
Vertical Card Pager
Use dynamic and beautiful card view pagers to help you create great apps.
Stars: ✭ 84 (-28.81%)
Mutual labels:  flutter-plugin
get version
Get Version - Get the Version Name, Version Code, Platform and OS Version, and App ID on iOS and Android. Maintainer: @rodydavis
Stars: ✭ 87 (-26.27%)
Mutual labels:  flutter-plugin
getx-snippets-intelliJ
An extension to accelerate the process of developing applications with flutter, aimed at everyone using the GetX package.
Stars: ✭ 52 (-55.93%)
Mutual labels:  flutter-plugin
expanding bottom bar
BottomNavigationBar for Flutter with expanding titles
Stars: ✭ 39 (-66.95%)
Mutual labels:  flutter-plugin
seo renderer
A Flutter Web Plugin to display Text Widget as Html for SEO purpose
Stars: ✭ 103 (-12.71%)
Mutual labels:  flutter-plugin
flutter easyloading
✨A clean and lightweight loading/toast widget for Flutter, easy to use without context, support iOS、Android and Web
Stars: ✭ 1,021 (+765.25%)
Mutual labels:  flutter-plugin
nats-dart
NATS client for Dart lang
Stars: ✭ 31 (-73.73%)
Mutual labels:  flutter-plugin
twilio flutter
A Flutter package for Twilio API.
Stars: ✭ 16 (-86.44%)
Mutual labels:  flutter-plugin
Free-RASP-Flutter
Flutter library for improving app security and threat monitoring on Android and iOS mobile devices.
Stars: ✭ 62 (-47.46%)
Mutual labels:  flutter-plugin
gbk2utf8
A flutter package to convert gbk to utf-8
Stars: ✭ 40 (-66.1%)
Mutual labels:  flutter-plugin
Some-Calendar
Custom calendar dialog widget for flutter with (multi select, single select, date range) mode
Stars: ✭ 69 (-41.53%)
Mutual labels:  flutter-plugin
umeng analytics plugin
Flutter 版友盟统计插件
Stars: ✭ 20 (-83.05%)
Mutual labels:  flutter-plugin
stop watch timer
This is Stop Watch Timer for flutter plugin.🏃‍♂️
Stars: ✭ 76 (-35.59%)
Mutual labels:  flutter-plugin
flutter-maplibre-gl
A flutter package for showing customizable vector/raster maps with Maplibre GL (forked from tobrun/flutter-mapbox-gl)
Stars: ✭ 69 (-41.53%)
Mutual labels:  flutter-plugin
nearby connections
Flutter plugin (android) for sharing bytes and files Offline, (Based on the android Nearby Connections API)
Stars: ✭ 64 (-45.76%)
Mutual labels:  flutter-plugin
flutter-app
Full Feature Todos Flutter Mobile app with fireStore integration.
Stars: ✭ 138 (+16.95%)
Mutual labels:  flutter-plugin
stream-feed-flutter
Stream Feed official Flutter SDK. Build your own feed experience using Dart and Flutter.
Stars: ✭ 67 (-43.22%)
Mutual labels:  flutter-plugin
fancy bar
A fancy yet beautiful animated widget for your Flutter apps
Stars: ✭ 33 (-72.03%)
Mutual labels:  flutter-plugin
flutter nfc kit
Flutter plugin to provide NFC functionality on Android and iOS, including reading metadata, read & write NDEF records, and transceive layer 3 & 4 data with NFC tags / cards
Stars: ✭ 119 (+0.85%)
Mutual labels:  flutter-plugin

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].