diff --git a/lib/controllers/miniPayerController.dart b/lib/controllers/miniPayerController.dart index 14785768..8b4282d1 100644 --- a/lib/controllers/miniPayerController.dart +++ b/lib/controllers/miniPayerController.dart @@ -35,6 +35,7 @@ class MiniPlayerController extends GetxController { int selectedFullScreenIndex = 0; bool isPip = false; bool isHidden = true; + bool isFullScreen = false; double progress = 0; Video? currentlyPlaying; double opacity = 0; @@ -61,7 +62,11 @@ class MiniPlayerController extends GetxController { } bool handleBackButton(bool stopDefaultButtonEvent, RouteInfo info) { - if (!isMini) { + if (isFullScreen) { + isFullScreen = false; + update(); + return false; + } else if (!isMini) { // we block the backbutton behavior and we make the player small showMiniPlayer(); return true; @@ -309,6 +314,12 @@ class MiniPlayerController extends GetxController { case BetterPlayerEventType.pipStop: isPip = false; break; + case BetterPlayerEventType.openFullscreen: + isFullScreen = true; + break; + case BetterPlayerEventType.hideFullscreen: + isFullScreen = false; + break; default: break; } diff --git a/lib/controllers/playerController.dart b/lib/controllers/playerController.dart index a50ee01f..22929796 100644 --- a/lib/controllers/playerController.dart +++ b/lib/controllers/playerController.dart @@ -115,6 +115,8 @@ class PlayerController extends GetxController { break; case BetterPlayerEventType.pipStart: case BetterPlayerEventType.pipStop: + case BetterPlayerEventType.openFullscreen: + case BetterPlayerEventType.hideFullscreen: MiniPlayerController.to()?.handleVideoEvent(event); break; default: @@ -136,6 +138,8 @@ class PlayerController extends GetxController { } switchVideo(Video video) { + videoController?.exitFullScreen(); + MiniPlayerController.to()?.handleVideoEvent(BetterPlayerEvent(BetterPlayerEventType.hideFullscreen)); disposeControllers(); this.video = video; playVideo(); @@ -197,7 +201,6 @@ class PlayerController extends GetxController { imageUrl: video.getBestThumbnail()?.url ?? '', )); - videoController = BetterPlayerController( BetterPlayerConfiguration( deviceOrientationsOnFullScreen: [DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight, DeviceOrientation.portraitDown, DeviceOrientation.portraitUp], @@ -209,8 +212,9 @@ class PlayerController extends GetxController { autoPlay: true, allowedScreenSleep: false, fit: BoxFit.contain, + controlsConfiguration: BetterPlayerControlsConfiguration( - enablePlayPause: false, + enablePlayPause: false, overflowModalColor: colors.background, overflowModalTextColor: overFlowTextColor, overflowMenuIconsColor: overFlowTextColor, diff --git a/lib/views/miniPlayer.dart b/lib/views/miniPlayer.dart index 885a92c6..2c27b2f1 100644 --- a/lib/views/miniPlayer.dart +++ b/lib/views/miniPlayer.dart @@ -10,9 +10,8 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import '../utils.dart'; class MiniPlayer extends StatelessWidget { - GlobalKey playerKey = GlobalKey(); - MiniPlayer({Key? key}) : super(key: key); + const MiniPlayer({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -47,7 +46,7 @@ class MiniPlayer extends StatelessWidget { return AnimatedPositioned( left: 0, - top: _.top, + top: _.isFullScreen ? 10000 : _.top, bottom: _.getBottom, right: 0, duration: _.isDragging ? Duration.zero : animationDuration, diff --git a/lib/views/video/player.dart b/lib/views/video/player.dart index 3e5b6121..48940e74 100644 --- a/lib/views/video/player.dart +++ b/lib/views/video/player.dart @@ -23,9 +23,9 @@ import '../../models/video.dart'; class VideoPlayer extends StatefulWidget { final Video video; final bool miniPlayer; - bool? playNow; + final bool? playNow; - VideoPlayer({super.key, required this.video, required this.miniPlayer, this.playNow}); + const VideoPlayer({super.key, required this.video, required this.miniPlayer, this.playNow}); @override State createState() => VideoPlayerState(); diff --git a/pubspec.lock b/pubspec.lock index 0244b53d..d48db16b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "98d1d33ed129b372846e862de23a0fc365745f4d7b5e786ce667fcbbb7ac5c07" + sha256: a36ec4843dc30ea6bf652bf25e3448db6c5e8bcf4aa55f063a5d1dad216d8214 url: "https://pub.dev" source: hosted - version: "55.0.0" + version: "58.0.0" after_layout: dependency: "direct main" description: @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: analyzer - sha256: "881348aed9b0b425882c97732629a6a31093c8ff20fc4b3b03fb9d3d50a3a126" + sha256: cc4242565347e98424ce9945c819c192ec0838cb9d1f6aa4a97cc96becbc5b27 url: "https://pub.dev" source: hosted - version: "5.7.1" + version: "5.10.0" application_icon: dependency: "direct main" description: @@ -70,7 +70,7 @@ packages: description: path: "." ref: master - resolved-ref: "203c2cc45456b41743ef464bc5132701d06d0260" + resolved-ref: "7fa406a7689cd744baca81fd67d9c70efb55563a" url: "https://github.com/lamarios/betterplayer.git" source: git version: "0.0.83" @@ -674,10 +674,10 @@ packages: dependency: transitive description: name: path_provider_foundation - sha256: "026b97a6c29da75181a37aae2eba9227f5fe13cb2838c6b975ce209328b8ab4e" + sha256: "818b2dc38b0f178e0ea3f7cf3b28146faab11375985d815942a68eee11c2d0f7" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.2.1" path_provider_linux: dependency: transitive description: @@ -738,10 +738,10 @@ packages: dependency: transitive description: name: pointycastle - sha256: db7306cf0249f838d1a24af52b5a5887c5bf7f31d8bb4e827d071dc0939ad346 + sha256: c3120a968135aead39699267f4c74bc9a08e4e909e86bc1b0af5bfd78691123c url: "https://pub.dev" source: hosted - version: "3.6.2" + version: "3.7.2" pool: dependency: transitive description: @@ -983,18 +983,18 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: "845530e5e05db5500c1a4c1446785d60cbd8f9bd45e21e7dd643a3273bb4bbd1" + sha256: dd729390aa936bf1bdf5cd1bc7468ff340263f80a2c4f569416507667de8e3c8 url: "https://pub.dev" source: hosted - version: "6.0.25" + version: "6.0.26" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "7ab1e5b646623d6a2537aa59d5d039f90eebef75a7c25e105f6f75de1f7750c3" + sha256: "3dedc66ca3c0bef9e6a93c0999aee102556a450afcc1b7bcfeace7a424927d92" url: "https://pub.dev" source: hosted - version: "6.1.2" + version: "6.1.3" url_launcher_linux: dependency: transitive description: