💄 Optimize file detail view styling
This commit is contained in:
@@ -76,7 +76,7 @@ class FileDetailScreen extends HookConsumerWidget {
|
||||
}, [animationController]);
|
||||
|
||||
return AppScaffold(
|
||||
isNoBackground: true,
|
||||
isNoBackground: false,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
@@ -86,28 +86,49 @@ class FileDetailScreen extends HookConsumerWidget {
|
||||
title: Text(item.name.isEmpty ? 'File Details' : item.name),
|
||||
actions: _buildAppBarActions(context, ref, showInfoSheet),
|
||||
),
|
||||
body: AnimatedBuilder(
|
||||
body: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return AnimatedBuilder(
|
||||
animation: animation,
|
||||
builder: (context, child) {
|
||||
return Row(
|
||||
return Stack(
|
||||
children: [
|
||||
// Main content area
|
||||
Expanded(child: _buildContent(context, ref, serverUrl)),
|
||||
// Animated drawer panel
|
||||
// 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)
|
||||
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(),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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,16 +266,6 @@ 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,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -309,7 +299,7 @@ class GenericFileContent extends HookConsumerWidget {
|
||||
FilledButton.icon(
|
||||
onPressed: downloadFile,
|
||||
icon: const Icon(Symbols.download),
|
||||
label: Text('download'),
|
||||
label: Text('download').tr(),
|
||||
),
|
||||
const Gap(16),
|
||||
OutlinedButton.icon(
|
||||
@@ -322,13 +312,12 @@ class GenericFileContent extends HookConsumerWidget {
|
||||
);
|
||||
},
|
||||
icon: const Icon(Symbols.info),
|
||||
label: Text('info'),
|
||||
label: Text('info').tr(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<UniversalVideo> {
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user