2020-05-16 06:02:33 +00:00
|
|
|
import 'package:famedlysdk/famedlysdk.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
2020-09-07 15:08:01 +00:00
|
|
|
import 'package:photo_view/photo_view.dart';
|
2020-10-15 13:51:24 +00:00
|
|
|
|
|
|
|
import '../components/image_bubble.dart';
|
|
|
|
import '../components/matrix.dart';
|
2020-05-16 06:02:33 +00:00
|
|
|
import '../utils/event_extension.dart';
|
|
|
|
|
|
|
|
class ImageView extends StatelessWidget {
|
|
|
|
final Event event;
|
|
|
|
|
|
|
|
const ImageView(this.event, {Key key}) : super(key: key);
|
|
|
|
|
|
|
|
void _forwardAction(BuildContext context) async {
|
|
|
|
Matrix.of(context).shareContent = event.content;
|
|
|
|
Navigator.of(context).popUntil((r) => r.isFirst);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Colors.black,
|
2020-05-20 17:29:26 +00:00
|
|
|
extendBodyBehindAppBar: true,
|
2020-05-16 06:02:33 +00:00
|
|
|
appBar: AppBar(
|
2020-05-20 17:29:26 +00:00
|
|
|
elevation: 0,
|
2020-05-16 06:02:33 +00:00
|
|
|
leading: IconButton(
|
|
|
|
icon: Icon(Icons.close),
|
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
2020-05-20 17:29:26 +00:00
|
|
|
backgroundColor: Color(0x44000000),
|
2020-05-16 06:02:33 +00:00
|
|
|
actions: [
|
|
|
|
IconButton(
|
|
|
|
icon: Icon(Icons.reply),
|
|
|
|
onPressed: () => _forwardAction(context),
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
IconButton(
|
|
|
|
icon: Icon(Icons.file_download),
|
2020-09-03 10:58:54 +00:00
|
|
|
onPressed: () => event.openFile(context, downloadOnly: true),
|
2020-05-16 06:02:33 +00:00
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2020-09-07 15:08:01 +00:00
|
|
|
body: PhotoView.customChild(
|
2020-05-16 07:12:57 +00:00
|
|
|
minScale: 1.0,
|
2020-05-16 07:13:37 +00:00
|
|
|
maxScale: 10.0,
|
2020-05-20 17:29:26 +00:00
|
|
|
child: ImageBubble(
|
|
|
|
event,
|
|
|
|
tapToView: false,
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
backgroundColor: Colors.black,
|
|
|
|
maxSize: false,
|
|
|
|
radius: 0.0,
|
2020-09-03 10:58:54 +00:00
|
|
|
thumbnailOnly: false,
|
2020-05-20 17:29:26 +00:00
|
|
|
),
|
2020-05-16 06:02:33 +00:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|