This commit is contained in:
Moustapha Kodjo Amadou 2025-03-11 09:39:03 +01:00
parent 56f8b080cc
commit f443065113
7 changed files with 33 additions and 28 deletions

View file

@ -126,14 +126,14 @@ class _MobileControllerWidgetState
for (final subscription in subscriptions) {
subscription.cancel();
}
// --------------------------------------------------
// package:screen_brightness
Future.microtask(() async {
try {
await ScreenBrightness.instance.resetApplicationScreenBrightness();
} catch (_) {}
});
// --------------------------------------------------
super.dispose();
}
@ -218,25 +218,24 @@ class _MobileControllerWidgetState
});
}
late final VolumeController _volumeController;
@override
void initState() {
super.initState();
// --------------------------------------------------
// package:volume_controller
_volumeController = VolumeController.instance;
Future.microtask(() async {
try {
VolumeController().showSystemUI = false;
_volumeValue.value = await VolumeController().getVolume();
VolumeController().listener((value) {
_volumeController.showSystemUI = false;
_volumeValue.value = await _volumeController.getVolume();
_volumeController.addListener((value) {
if (mounted && !_volumeInterceptEventStream) {
_volumeValue.value = value;
}
});
} catch (_) {}
});
// --------------------------------------------------
// --------------------------------------------------
// package:screen_brightness
Future.microtask(() async {
try {
_brightnessValue.value = await ScreenBrightness.instance.application;
@ -249,14 +248,11 @@ class _MobileControllerWidgetState
});
} catch (_) {}
});
// --------------------------------------------------
}
Future<void> setVolume(double value) async {
// --------------------------------------------------
// package:volume_controller
try {
VolumeController().setVolume(value);
_volumeController.setVolume(value);
} catch (_) {}
_volumeValue.value = value;
_volumeIndicator.value = true;
@ -268,11 +264,9 @@ class _MobileControllerWidgetState
_volumeInterceptEventStream = false;
}
});
// --------------------------------------------------
}
Future<void> setBrightness(double value) async {
// --------------------------------------------------
// package:screen_brightness
try {
await ScreenBrightness.instance.setApplicationScreenBrightness(value);
@ -284,7 +278,6 @@ class _MobileControllerWidgetState
_brightnessIndicator.value = false;
}
});
// --------------------------------------------------
}
@override

View file

@ -23,6 +23,7 @@ import share_plus
import sqflite_darwin
import url_launcher_macos
import video_player_avfoundation
import volume_controller
import wakelock_plus
import webview_flutter_wkwebview
import window_manager
@ -47,6 +48,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
VolumeControllerPlugin.register(with: registry.registrar(forPlugin: "VolumeControllerPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
FLTWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "FLTWebViewFlutterPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))

View file

@ -45,6 +45,8 @@ PODS:
- video_player_avfoundation (0.0.1):
- Flutter
- FlutterMacOS
- volume_controller (0.0.1):
- FlutterMacOS
- wakelock_plus (0.0.1):
- FlutterMacOS
- webview_flutter_wkwebview (0.0.1):
@ -77,6 +79,7 @@ DEPENDENCIES:
- sqflite_darwin (from `Flutter/ephemeral/.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- video_player_avfoundation (from `Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin`)
- volume_controller (from `Flutter/ephemeral/.symlinks/plugins/volume_controller/macos`)
- wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`)
- webview_flutter_wkwebview (from `Flutter/ephemeral/.symlinks/plugins/webview_flutter_wkwebview/darwin`)
- window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`)
@ -129,6 +132,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
video_player_avfoundation:
:path: Flutter/ephemeral/.symlinks/plugins/video_player_avfoundation/darwin
volume_controller:
:path: Flutter/ephemeral/.symlinks/plugins/volume_controller/macos
wakelock_plus:
:path: Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos
webview_flutter_wkwebview:
@ -161,6 +166,7 @@ SPEC CHECKSUMS:
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
url_launcher_macos: 0fba8ddabfc33ce0a9afe7c5fef5aab3d8d2d673
video_player_avfoundation: 2cef49524dd1f16c5300b9cd6efd9611ce03639b
volume_controller: 5c068e6d085c80dadd33fc2c918d2114b775b3dd
wakelock_plus: 21ddc249ac4b8d018838dbdabd65c5976c308497
webview_flutter_wkwebview: 44d4dee7d7056d5ad185d25b38404436d56c547c
window_manager: 1d01fa7ac65a6e6f83b965471b1a7fdd3f06166c

View file

@ -1121,8 +1121,8 @@ packages:
dependency: "direct main"
description:
path: media_kit
ref: "652c49e02701bb6bb80953a6fdf650a5c8f002f9"
resolved-ref: "652c49e02701bb6bb80953a6fdf650a5c8f002f9"
ref: d2145a50f68394096845915a28874341fbf5b3fe
resolved-ref: d2145a50f68394096845915a28874341fbf5b3fe
url: "https://github.com/media-kit/media-kit.git"
source: git
version: "1.1.11"
@ -1170,8 +1170,8 @@ packages:
dependency: "direct overridden"
description:
path: "libs/windows/media_kit_libs_windows_video"
ref: "652c49e02701bb6bb80953a6fdf650a5c8f002f9"
resolved-ref: "652c49e02701bb6bb80953a6fdf650a5c8f002f9"
ref: d2145a50f68394096845915a28874341fbf5b3fe
resolved-ref: d2145a50f68394096845915a28874341fbf5b3fe
url: "https://github.com/media-kit/media-kit.git"
source: git
version: "1.0.10"
@ -1187,8 +1187,8 @@ packages:
dependency: "direct main"
description:
path: media_kit_video
ref: "652c49e02701bb6bb80953a6fdf650a5c8f002f9"
resolved-ref: "652c49e02701bb6bb80953a6fdf650a5c8f002f9"
ref: d2145a50f68394096845915a28874341fbf5b3fe
resolved-ref: d2145a50f68394096845915a28874341fbf5b3fe
url: "https://github.com/media-kit/media-kit.git"
source: git
version: "1.2.5"
@ -2024,10 +2024,10 @@ packages:
dependency: transitive
description:
name: volume_controller
sha256: c71d4c62631305df63b72da79089e078af2659649301807fa746088f365cb48e
sha256: "30863a51338db47fe16f92902b1a6c4ee5e15c9287b46573d7c2eb6be1f197d2"
url: "https://pub.dev"
source: hosted
version: "2.0.8"
version: "3.3.1"
wakelock_plus:
dependency: transitive
description:

View file

@ -47,7 +47,7 @@ dependencies:
git:
url: https://github.com/media-kit/media-kit.git
path: media_kit_video
ref: 652c49e02701bb6bb80953a6fdf650a5c8f002f9
ref: d2145a50f68394096845915a28874341fbf5b3fe
media_kit_libs_video: ^1.0.4
crypto: ^3.0.6
cupertino_icons: ^1.0.8
@ -92,12 +92,12 @@ dependency_overrides:
git:
url: https://github.com/media-kit/media-kit.git
path: libs/windows/media_kit_libs_windows_video
ref: 652c49e02701bb6bb80953a6fdf650a5c8f002f9
ref: d2145a50f68394096845915a28874341fbf5b3fe
media_kit:
git:
url: https://github.com/media-kit/media-kit.git
path: media_kit
ref: 652c49e02701bb6bb80953a6fdf650a5c8f002f9
ref: d2145a50f68394096845915a28874341fbf5b3fe
meta: ^1.15.0
collection: ^1.19.0
js: ^0.7.1

View file

@ -18,6 +18,7 @@
#include <screen_retriever_windows/screen_retriever_windows_plugin_c_api.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h>
#include <volume_controller/volume_controller_plugin_c_api.h>
#include <window_manager/window_manager_plugin.h>
#include <window_to_front/window_to_front_plugin.h>
@ -46,6 +47,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
VolumeControllerPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("VolumeControllerPluginCApi"));
WindowManagerPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowManagerPlugin"));
WindowToFrontPluginRegisterWithRegistrar(

View file

@ -15,6 +15,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
screen_retriever_windows
share_plus
url_launcher_windows
volume_controller
window_manager
window_to_front
)