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