Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Siddharth Sogani <[email protected]>
  • Loading branch information
Siddharth2212 committed Feb 10, 2024
1 parent 62782b7 commit 2b8c47f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
6 changes: 4 additions & 2 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
15 changes: 8 additions & 7 deletions lib/src/flick_video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -86,7 +86,7 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer>
_setPreferredOrientation();

if (widget.wakelockEnabled) {
Wakelock.enable();
WakelockPlus.toggle(enable: true);
}

if (kIsWeb) {
Expand All @@ -102,7 +102,7 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer>
void dispose() {
flickManager.flickControlManager!.removeListener(listener);
if (widget.wakelockEnabled) {
Wakelock.disable();
WakelockPlus.toggle(enable: false);
}
WidgetsBinding.instance.removeObserver(this);
super.dispose();
Expand Down Expand Up @@ -131,8 +131,9 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer>
_switchToFullscreen() {
if (widget.wakelockEnabledFullscreen) {
/// Disable previous wakelock setting.
Wakelock.disable();
Wakelock.enable();
WakelockPlus.toggle(enable: false);

WakelockPlus.toggle(enable: true);
}

_isFullscreen = true;
Expand Down Expand Up @@ -163,8 +164,8 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer>
_exitFullscreen() {
if (widget.wakelockEnabled) {
/// Disable previous wakelock setting.
Wakelock.disable();
Wakelock.enable();
WakelockPlus.toggle(enable: false);
WakelockPlus.toggle(enable: true);
}

_isFullscreen = false;
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2b8c47f

Please sign in to comment.