🐛 Update the image site file list, close #204
This commit is contained in:
@@ -78,8 +78,7 @@ class FileItem extends HookConsumerWidget {
|
||||
if (context.mounted) {
|
||||
await Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) => Scaffold(
|
||||
builder: (context) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(file.relativePath),
|
||||
backgroundColor: Colors.transparent,
|
||||
@@ -90,14 +89,11 @@ class FileItem extends HookConsumerWidget {
|
||||
body: PhotoView(
|
||||
imageProvider: CachedNetworkImageProvider(
|
||||
imageUrl,
|
||||
headers:
|
||||
token != null
|
||||
headers: token != null
|
||||
? {'Authorization': 'AtField $token'}
|
||||
: null,
|
||||
),
|
||||
heroAttributes: PhotoViewHeroAttributes(
|
||||
tag: file.relativePath,
|
||||
),
|
||||
heroAttributes: PhotoViewHeroAttributes(tag: file.relativePath),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -107,7 +103,16 @@ class FileItem extends HookConsumerWidget {
|
||||
|
||||
Future<void> _openFile(BuildContext context, WidgetRef ref) async {
|
||||
final ext = file.relativePath.split('.').last.toLowerCase();
|
||||
final isImage = ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'].contains(ext);
|
||||
final isImage = [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
'gif',
|
||||
'webp',
|
||||
'bmp',
|
||||
'ico',
|
||||
'svg',
|
||||
].contains(ext);
|
||||
|
||||
if (isImage) {
|
||||
await _showImageViewer(context, ref);
|
||||
@@ -182,8 +187,7 @@ class FileItem extends HookConsumerWidget {
|
||||
: '${(file.size / 1024).toStringAsFixed(1)} KB',
|
||||
),
|
||||
trailing: PopupMenuButton<String>(
|
||||
itemBuilder:
|
||||
(context) => [
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
value: 'download',
|
||||
child: Row(
|
||||
@@ -228,8 +232,7 @@ class FileItem extends HookConsumerWidget {
|
||||
case 'delete':
|
||||
final confirmed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder:
|
||||
(context) => AlertDialog(
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Delete File'),
|
||||
content: Text(
|
||||
'Are you sure you want to delete "${file.relativePath}"?',
|
||||
|
||||
Reference in New Issue
Block a user