diff --git a/lib/screens/files/file_detail.dart b/lib/screens/files/file_detail.dart index acbeb466..db6505e3 100644 --- a/lib/screens/files/file_detail.dart +++ b/lib/screens/files/file_detail.dart @@ -76,7 +76,7 @@ class FileDetailScreen extends HookConsumerWidget { }, [animationController]); return AppScaffold( - isNoBackground: true, + isNoBackground: false, appBar: AppBar( elevation: 0, leading: IconButton( @@ -86,26 +86,47 @@ class FileDetailScreen extends HookConsumerWidget { title: Text(item.name.isEmpty ? 'File Details' : item.name), actions: _buildAppBarActions(context, ref, showInfoSheet), ), - body: AnimatedBuilder( - animation: animation, - builder: (context, child) { - return Row( - children: [ - // Main content area - Expanded(child: _buildContent(context, ref, serverUrl)), - // Animated drawer panel - if (isWide) - SizedBox( - height: double.infinity, - width: animation.value * 400, // Max width of 400px - child: Container( - child: - animation.value > 0.1 - ? FileInfoSheet(item: item, onClose: showInfoSheet) - : const SizedBox.shrink(), + body: LayoutBuilder( + builder: (context, constraints) { + return AnimatedBuilder( + animation: animation, + builder: (context, child) { + return Stack( + children: [ + // Main content area - resizes with animation + Positioned( + left: 0, + top: 0, + bottom: 0, + width: constraints.maxWidth - animation.value * 400, + child: _buildContent(context, ref, serverUrl), ), - ), - ], + // Animated drawer panel - overlays + if (isWide) + Positioned( + right: 0, + top: 0, + bottom: 0, + width: 400, + child: Transform.translate( + offset: Offset((1 - animation.value) * 400, 0), + child: SizedBox( + width: 400, + child: Material( + color: + Theme.of(context).colorScheme.surfaceContainer, + elevation: 8, + child: FileInfoSheet( + item: item, + onClose: showInfoSheet, + ), + ), + ), + ), + ), + ], + ); + }, ); }, ), diff --git a/lib/widgets/content/file_viewer_contents.dart b/lib/widgets/content/file_viewer_contents.dart index 3f925ec7..b7889b2d 100644 --- a/lib/widgets/content/file_viewer_contents.dart +++ b/lib/widgets/content/file_viewer_contents.dart @@ -1,7 +1,7 @@ import 'dart:io'; import 'dart:math' as math; -import 'dart:ui'; +import 'package:easy_localization/easy_localization.dart'; import 'package:file_saver/file_saver.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; @@ -266,68 +266,57 @@ class GenericFileContent extends HookConsumerWidget { } return Center( - child: Container( - margin: const EdgeInsets.all(32), - padding: const EdgeInsets.all(32), - decoration: BoxDecoration( - border: Border.all( - color: Theme.of(context).colorScheme.outline, - width: 1, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon( + Symbols.insert_drive_file, + size: 64, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), - borderRadius: BorderRadius.circular(16), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Icon( - Symbols.insert_drive_file, - size: 64, + const Gap(16), + Text( + item.name, + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Theme.of(context).colorScheme.onSurface, + ), + textAlign: TextAlign.center, + ), + const Gap(8), + Text( + formatFileSize(item.size), + style: TextStyle( + fontSize: 16, color: Theme.of(context).colorScheme.onSurfaceVariant, ), - const Gap(16), - Text( - item.name, - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: Theme.of(context).colorScheme.onSurface, + ), + const Gap(24), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + FilledButton.icon( + onPressed: downloadFile, + icon: const Icon(Symbols.download), + label: Text('download').tr(), ), - textAlign: TextAlign.center, - ), - const Gap(8), - Text( - formatFileSize(item.size), - style: TextStyle( - fontSize: 16, - color: Theme.of(context).colorScheme.onSurfaceVariant, + const Gap(16), + OutlinedButton.icon( + onPressed: () { + showModalBottomSheet( + useRootNavigator: true, + context: context, + isScrollControlled: true, + builder: (context) => FileInfoSheet(item: item), + ); + }, + icon: const Icon(Symbols.info), + label: Text('info').tr(), ), - ), - const Gap(24), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - FilledButton.icon( - onPressed: downloadFile, - icon: const Icon(Symbols.download), - label: Text('download'), - ), - const Gap(16), - OutlinedButton.icon( - onPressed: () { - showModalBottomSheet( - useRootNavigator: true, - context: context, - isScrollControlled: true, - builder: (context) => FileInfoSheet(item: item), - ); - }, - icon: const Icon(Symbols.info), - label: Text('info'), - ), - ], - ), - ], - ), + ], + ), + ], ), ); } diff --git a/lib/widgets/content/video.native.dart b/lib/widgets/content/video.native.dart index dc47a694..e67a7a1d 100644 --- a/lib/widgets/content/video.native.dart +++ b/lib/widgets/content/video.native.dart @@ -1,10 +1,7 @@ import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:island/pods/network.dart'; -import 'package:island/talker.dart'; import 'package:media_kit/media_kit.dart'; import 'package:media_kit_video/media_kit_video.dart'; @@ -28,28 +25,12 @@ class _UniversalVideoState extends ConsumerState { VideoController? _videoController; void _openVideo() async { - final url = widget.uri; MediaKit.ensureInitialized(); _player = Player(); _videoController = VideoController(_player!); - String? uri; - final inCacheInfo = await DefaultCacheManager().getFileFromCache(url); - if (inCacheInfo == null) { - talker.info('[MediaPlayer] Miss cache: $url'); - final token = ref.watch(tokenProvider)?.token; - DefaultCacheManager().downloadFile( - url, - authHeaders: {'Authorization': 'AtField $token'}, - ); - uri = url; - } else { - uri = inCacheInfo.file.path; - talker.info('[MediaPlayer] Hit cache: $url'); - } - - _player!.open(Media(uri), play: widget.autoplay); + _player!.open(Media(widget.uri), play: widget.autoplay); } @override