Set high refresh rate on Android.

This commit is contained in:
2025-06-23 19:39:47 +08:00
parent 85baac657a
commit 23ee79fe9d
3 changed files with 15 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:display_mode/display_mode.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_saf/flutter_saf.dart';
@@ -50,6 +51,11 @@ Future<void> init() async {
if (App.isAndroid) {
handleLinks();
handleTextShare();
try {
await FlutterDisplayMode.setHighRefreshRate();
} catch(e) {
Log.error("Display Mode", "Failed to set high refresh rate: $e");
}
}
FlutterError.onError = (details) {
Log.error("Unhandled Exception", "${details.exception}\n${details.stack}");

View File

@@ -170,6 +170,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.0"
display_mode:
dependency: "direct main"
description:
name: display_mode
sha256: "8a381f3602a09dc4e96140a0df30808631468d6d0dfff7722f67b1f83757a7cc"
url: "https://pub.dev"
source: hosted
version: "0.0.2"
dynamic_color:
dependency: "direct main"
description:

View File

@@ -86,6 +86,7 @@ dependencies:
sdk: flutter
yaml: ^3.1.3
enough_convert: ^1.6.0
display_mode: ^0.0.2
dev_dependencies:
flutter_test: