2024-05-05 15:01:08 +00:00
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
2024-04-13 11:47:31 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-05-05 15:01:08 +00:00
|
|
|
import 'package:solian/utils/platform.dart';
|
2024-04-13 11:47:31 +00:00
|
|
|
|
|
|
|
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-05-05 15:01:08 +00:00
|
|
|
child: PlatformInfo.canCacheImage ? CachedNetworkImage(imageUrl: url, fit: BoxFit.contain) : Image.network(url),
|
2024-04-15 15:08:32 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
|
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);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|