From a4d50289c26320b83d054ae2368e4d0b7d8b7b14 Mon Sep 17 00:00:00 2001 From: Flummi Date: Wed, 11 Jun 2025 14:53:26 +0200 Subject: [PATCH] v1.1.19+49 --- lib/screens/fullscreen_screen.dart | 87 +++++++++--------------- lib/widgets/video_widget.dart | 103 +++++++++++++++++++++-------- pubspec.yaml | 4 +- 3 files changed, 109 insertions(+), 85 deletions(-) diff --git a/lib/screens/fullscreen_screen.dart b/lib/screens/fullscreen_screen.dart index 2c9e72e..9eebe76 100644 --- a/lib/screens/fullscreen_screen.dart +++ b/lib/screens/fullscreen_screen.dart @@ -16,9 +16,6 @@ class FullScreenMediaView extends StatefulWidget { } class _FullScreenMediaViewState extends State { - double _dragOffset = 0.0; - int _pointerCount = 0; - @override void initState() { super.initState(); @@ -33,68 +30,44 @@ class _FullScreenMediaViewState extends State { super.dispose(); } - void _onVerticalDragUpdate(DragUpdateDetails details) { - if (_pointerCount != 1) return; - setState(() => _dragOffset += details.delta.dy); - } - - void _onVerticalDragEnd(DragEndDetails details) { - if (_dragOffset < -100 || _dragOffset > 100) { - Navigator.of(context).pop(); - } else { - setState(() => _dragOffset = 0.0); - } - } - @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, - body: Listener( - onPointerDown: (_) { - setState(() => _pointerCount++); - }, - onPointerUp: (_) { - setState(() => _pointerCount = (_pointerCount - 1).clamp(0, 10)); - }, - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onVerticalDragUpdate: _onVerticalDragUpdate, - onVerticalDragEnd: _onVerticalDragEnd, - child: Transform.translate( - offset: Offset(0, _dragOffset), - child: Stack( - children: [ - Center( - child: widget.item.mime.startsWith('image') - ? InteractiveViewer( - minScale: 1.0, - maxScale: 4.0, - child: CachedNetworkImage( - imageUrl: widget.item.mediaUrl, - fit: BoxFit.contain, - placeholder: (context, url) => const Center( - child: CircularProgressIndicator(), - ), - errorWidget: (context, url, error) => - const Icon(Icons.error, color: Colors.white), - ), - ) - : VideoWidget(details: widget.item, isActive: true), - ), - SafeArea( - child: Align( - alignment: Alignment.topLeft, - child: IconButton( - icon: const Icon(Icons.arrow_back, color: Colors.white), - onPressed: () => Navigator.of(context).pop(), + body: Stack( + children: [ + Positioned.fill( + child: widget.item.mime.startsWith('image') + ? InteractiveViewer( + minScale: 1.0, + maxScale: 6.0, + child: CachedNetworkImage( + imageUrl: widget.item.mediaUrl, + fit: BoxFit.contain, + placeholder: (context, url) => + const Center(child: CircularProgressIndicator()), + errorWidget: (context, url, error) => + const Icon(Icons.error), + ), + ) + : SizedBox.expand( + child: VideoWidget( + details: widget.item, + isActive: true, + fullScreen: true, ), ), - ), - ], + ), + SafeArea( + child: Align( + alignment: Alignment.topLeft, + child: IconButton( + icon: const Icon(Icons.arrow_back), + onPressed: () => Navigator.of(context).pop(), + ), ), ), - ), + ], ), ); } diff --git a/lib/widgets/video_widget.dart b/lib/widgets/video_widget.dart index cac9383..739aab5 100644 --- a/lib/widgets/video_widget.dart +++ b/lib/widgets/video_widget.dart @@ -13,8 +13,14 @@ import 'package:f0ckapp/providers/media_provider.dart'; class VideoWidget extends ConsumerStatefulWidget { final MediaItem details; final bool isActive; + final bool fullScreen; - const VideoWidget({super.key, required this.details, required this.isActive}); + const VideoWidget({ + super.key, + required this.details, + required this.isActive, + this.fullScreen = false, + }); @override ConsumerState createState() => _VideoWidgetState(); @@ -90,17 +96,15 @@ class _VideoWidgetState extends ConsumerState { bool isAudio = widget.details.mime.startsWith('audio'); - return Column( - mainAxisSize: MainAxisSize.min, - children: [ - AspectRatio( - aspectRatio: _controller.value.isInitialized - ? _controller.value.aspectRatio - : 9 / 16, - child: Stack( - alignment: Alignment.topCenter, - children: [ - GestureDetector( + if (widget.fullScreen) { + return Stack( + children: [ + Center( + child: AspectRatio( + aspectRatio: _controller.value.isInitialized + ? _controller.value.aspectRatio + : 9 / 16, + child: GestureDetector( onTap: _onTap, child: isAudio ? CachedNetworkImage( @@ -118,24 +122,71 @@ class _VideoWidgetState extends ConsumerState { ? CachedVideoPlayerPlus(_controller) : const Center(child: CircularProgressIndicator()), ), - if (_controller.value.isInitialized && _showControls) ...[ - IgnorePointer( - ignoring: true, - child: Container( - color: Colors.black.withValues(alpha: 0.5), - width: double.infinity, - height: double.infinity, + ), + ), + if (_controller.value.isInitialized && _showControls) + Positioned.fill( + child: GestureDetector( + onTap: _onTap, + child: Container( + color: Colors.black.withValues(alpha: 0.5), + child: VideoControlsOverlay( + controller: _controller, + button: () => _onTap(ctrlButton: true), ), ), - VideoControlsOverlay( - controller: _controller, - button: () => _onTap(ctrlButton: true), + ), + ), + ], + ); + } else { + return Column( + mainAxisSize: MainAxisSize.min, + children: [ + AspectRatio( + aspectRatio: _controller.value.isInitialized + ? _controller.value.aspectRatio + : 9 / 16, + child: Stack( + alignment: Alignment.topCenter, + children: [ + GestureDetector( + onTap: _onTap, + child: isAudio + ? CachedNetworkImage( + imageUrl: widget.details.coverUrl, + fit: BoxFit.cover, + placeholder: (context, url) => + const CircularProgressIndicator(), + errorWidget: (context, url, error) => Image.asset( + 'assets/images/music.webp', + fit: BoxFit.contain, + width: double.infinity, + ), + ) + : _controller.value.isInitialized + ? CachedVideoPlayerPlus(_controller) + : const Center(child: CircularProgressIndicator()), ), + if (_controller.value.isInitialized && _showControls) ...[ + IgnorePointer( + ignoring: true, + child: Container( + color: Colors.black.withValues(alpha: 0.5), + width: double.infinity, + height: double.infinity, + ), + ), + VideoControlsOverlay( + controller: _controller, + button: () => _onTap(ctrlButton: true), + ), + ], ], - ], + ), ), - ), - ], - ); + ], + ); + } } } diff --git a/pubspec.yaml b/pubspec.yaml index 6f0581a..6c191eb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: f0ckapp -description: "A new Flutter project." +description: "f0ck schm0ck" # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. publish_to: 'none' # Remove this line if you wish to publish to pub.dev @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.1.18+48 +version: 1.1.19+49 environment: sdk: ^3.9.0-100.2.beta