Solian/lib/widgets/posts/attachment_screen.dart

36 lines
874 B
Dart
Raw Normal View History

2024-04-13 11:47:31 +00:00
import 'package:flutter/material.dart';
class AttachmentScreen extends StatelessWidget {
final String url;
2024-04-15 15:08:32 +00:00
final String? tag;
2024-04-13 11:47:31 +00:00
2024-04-15 15:08:32 +00:00
const AttachmentScreen({super.key, this.tag, required this.url});
2024-04-13 11:47:31 +00:00
@override
Widget build(BuildContext context) {
2024-04-15 15:08:32 +00:00
final image = SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: InteractiveViewer(
boundaryMargin: const EdgeInsets.all(128),
minScale: 0.1,
2024-05-01 11:39:48 +00:00
maxScale: 16,
panEnabled: true,
scaleEnabled: true,
2024-04-15 15:08:32 +00:00
child: Image.network(url, fit: BoxFit.contain),
),
);
2024-04-13 11:47:31 +00:00
return Scaffold(
body: GestureDetector(
child: Center(
2024-04-15 15:08:32 +00:00
child: tag != null ? Hero(tag: tag!, child: image) : image,
2024-04-13 11:47:31 +00:00
),
onTap: () {
Navigator.pop(context);
},
),
);
}
}