diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index be193d92..1565b60e 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,12 +5,14 @@ import FlutterMacOS import Foundation +import package_info_plus import path_provider_foundation import video_player_avfoundation -import wakelock_macos +import wakelock_plus func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) - WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) + WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) } diff --git a/lib/src/flick_video_player.dart b/lib/src/flick_video_player.dart index 31342917..424f8364 100644 --- a/lib/src/flick_video_player.dart +++ b/lib/src/flick_video_player.dart @@ -4,7 +4,7 @@ import 'package:flick_video_player/flick_video_player.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:wakelock/wakelock.dart'; +import 'package:wakelock_plus/wakelock_plus.dart'; class FlickVideoPlayer extends StatefulWidget { const FlickVideoPlayer({ @@ -86,7 +86,7 @@ class _FlickVideoPlayerState extends State _setPreferredOrientation(); if (widget.wakelockEnabled) { - Wakelock.enable(); + WakelockPlus.toggle(enable: true); } if (kIsWeb) { @@ -102,7 +102,7 @@ class _FlickVideoPlayerState extends State void dispose() { flickManager.flickControlManager!.removeListener(listener); if (widget.wakelockEnabled) { - Wakelock.disable(); + WakelockPlus.toggle(enable: false); } WidgetsBinding.instance.removeObserver(this); super.dispose(); @@ -131,8 +131,9 @@ class _FlickVideoPlayerState extends State _switchToFullscreen() { if (widget.wakelockEnabledFullscreen) { /// Disable previous wakelock setting. - Wakelock.disable(); - Wakelock.enable(); + WakelockPlus.toggle(enable: false); + + WakelockPlus.toggle(enable: true); } _isFullscreen = true; @@ -163,8 +164,8 @@ class _FlickVideoPlayerState extends State _exitFullscreen() { if (widget.wakelockEnabled) { /// Disable previous wakelock setting. - Wakelock.disable(); - Wakelock.enable(); + WakelockPlus.toggle(enable: false); + WakelockPlus.toggle(enable: true); } _isFullscreen = false; diff --git a/pubspec.yaml b/pubspec.yaml index 7312004c..962f26d6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,8 @@ dependencies: sdk: flutter video_player: ^2.8.1 provider: ^6.1.1 - wakelock: ^0.6.2 + package_info_plus: ^5.0.1 + wakelock_plus: ^1.1.4 universal_html: ^2.2.4 dio: ^5.4.0 path_provider: ^2.1.1