Surface/lib/widgets/attachment/attachment_detail.dart

42 lines
1.3 KiB
Dart
Raw Normal View History

2024-11-10 09:21:57 +00:00
import 'package:dismissible_page/dismissible_page.dart';
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';
import 'package:provider/provider.dart';
import 'package:surface/providers/sn_network.dart';
import 'package:surface/types/attachment.dart';
import 'package:surface/widgets/universal_image.dart';
import 'package:uuid/uuid.dart';
class AttachmentDetailPopup extends StatelessWidget {
final SnAttachment data;
final String? heroTag;
const AttachmentDetailPopup({super.key, required this.data, this.heroTag});
@override
Widget build(BuildContext context) {
final sn = context.read<SnNetworkProvider>();
final uuid = Uuid();
return DismissiblePage(
onDismissed: () {
Navigator.of(context).pop();
},
direction: DismissiblePageDismissDirection.down,
backgroundColor: Colors.transparent,
isFullScreen: true,
child: Hero(
tag: 'attachment-${data.rid}-${heroTag ?? uuid.v4()}',
child: PhotoView(
2024-11-11 12:06:00 +00:00
key: Key('attachment-detail-${data.rid}-$heroTag'),
2024-11-13 13:36:28 +00:00
backgroundDecoration: BoxDecoration(
color: Colors.black.withOpacity(0.7),
),
2024-11-10 09:21:57 +00:00
imageProvider: UniversalImage.provider(
sn.getAttachmentUrl(data.rid),
),
),
),
);
}
}