Skip to content

Commit

Permalink
feat: Force High Refresh Rate on some Android devices (#607)
Browse files Browse the repository at this point in the history
* Force High Refresh Rate on some Android devices

* fix: check android platform for high refresh-rate

---------

Co-authored-by: Kingkor Roy Tirtho <krtirtho@gmail.com>
  • Loading branch information
karniv00l and KRTirtho committed Aug 2, 2023
1 parent 042d7a4 commit 6dff099
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/main.dart
Expand Up @@ -36,6 +36,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:spotube/hooks/use_init_sys_tray.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:flutter_displaymode/flutter_displaymode.dart';

Future<void> main(List<String> rawArgs) async {
final parser = ArgParser();
Expand Down Expand Up @@ -85,6 +86,11 @@ Future<void> main(List<String> rawArgs) async {

MediaKit.ensureInitialized();

// force High Refresh Rate on some Android devices (like One Plus)
if (DesktopTools.platform.isAndroid) {
await FlutterDisplayMode.setHighRefreshRate();
}

await DesktopTools.ensureInitialized(
DesktopWindowOptions(
hideTitleBar: true,
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Expand Up @@ -632,6 +632,14 @@ packages:
url: "https://github.com/KRTirtho/flutter_desktop_tools.git"
source: git
version: "0.0.1"
flutter_displaymode:
dependency: "direct main"
description:
name: flutter_displaymode
sha256: "42c5e9abd13d28ed74f701b60529d7f8416947e58256e6659c5550db719c57ef"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
flutter_distributor:
dependency: "direct dev"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Expand Up @@ -97,6 +97,7 @@ dependencies:
duration: ^3.0.12
disable_battery_optimization: ^1.1.0+1
youtube_explode_dart: ^1.12.4
flutter_displaymode: ^0.6.0

dev_dependencies:
build_runner: ^2.3.2
Expand Down

0 comments on commit 6dff099

Please sign in to comment.