2021-04-15 13:03:14 +02:00
|
|
|
import '../image_viewer.dart';
|
2021-05-22 08:53:52 +02:00
|
|
|
import 'package:fluffychat/widgets/image_bubble.dart';
|
2020-05-16 08:02:33 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2021-02-20 07:40:42 +01:00
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
2020-05-16 08:02:33 +02:00
|
|
|
|
2021-04-15 13:03:14 +02:00
|
|
|
class ImageViewerUI extends StatelessWidget {
|
2021-04-10 09:06:24 +02:00
|
|
|
final ImageViewerController controller;
|
2020-05-16 08:02:33 +02:00
|
|
|
|
2021-04-15 13:03:14 +02:00
|
|
|
const ImageViewerUI(this.controller, {Key key}) : super(key: key);
|
2020-05-16 08:02:33 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Colors.black,
|
2020-05-20 19:29:26 +02:00
|
|
|
extendBodyBehindAppBar: true,
|
2020-05-16 08:02:33 +02:00
|
|
|
appBar: AppBar(
|
2020-05-20 19:29:26 +02:00
|
|
|
elevation: 0,
|
2020-05-16 08:02:33 +02:00
|
|
|
leading: IconButton(
|
|
|
|
icon: Icon(Icons.close),
|
2021-04-10 09:06:24 +02:00
|
|
|
onPressed: Navigator.of(context, rootNavigator: false).pop,
|
2020-05-16 08:02:33 +02:00
|
|
|
color: Colors.white,
|
2021-02-20 07:40:42 +01:00
|
|
|
tooltip: L10n.of(context).close,
|
2020-05-16 08:02:33 +02:00
|
|
|
),
|
2020-05-20 19:29:26 +02:00
|
|
|
backgroundColor: Color(0x44000000),
|
2020-05-16 08:02:33 +02:00
|
|
|
actions: [
|
|
|
|
IconButton(
|
2020-12-06 10:31:35 +01:00
|
|
|
icon: Icon(Icons.reply_outlined),
|
2021-04-13 16:08:28 +02:00
|
|
|
onPressed: controller.forwardAction,
|
2020-05-16 08:02:33 +02:00
|
|
|
color: Colors.white,
|
2021-02-20 07:40:42 +01:00
|
|
|
tooltip: L10n.of(context).share,
|
2020-05-16 08:02:33 +02:00
|
|
|
),
|
|
|
|
IconButton(
|
2020-12-06 10:31:35 +01:00
|
|
|
icon: Icon(Icons.download_outlined),
|
2021-04-13 16:08:28 +02:00
|
|
|
onPressed: controller.openFileAction,
|
2020-05-16 08:02:33 +02:00
|
|
|
color: Colors.white,
|
2021-02-20 07:40:42 +01:00
|
|
|
tooltip: L10n.of(context).downloadFile,
|
2020-05-16 08:02:33 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2021-01-18 07:56:02 +01:00
|
|
|
body: InteractiveViewer(
|
2021-03-04 12:28:06 +01:00
|
|
|
minScale: 1.0,
|
|
|
|
maxScale: 10.0,
|
2021-04-10 09:06:24 +02:00
|
|
|
onInteractionEnd: controller.onInteractionEnds,
|
2021-01-18 07:56:02 +01:00
|
|
|
child: Center(
|
|
|
|
child: ImageBubble(
|
2021-04-10 09:06:24 +02:00
|
|
|
controller.widget.event,
|
2021-01-18 07:56:02 +01:00
|
|
|
tapToView: false,
|
2021-04-10 09:06:24 +02:00
|
|
|
onLoaded: controller.widget.onLoaded,
|
2021-01-18 07:56:02 +01:00
|
|
|
fit: BoxFit.contain,
|
|
|
|
backgroundColor: Colors.black,
|
|
|
|
maxSize: false,
|
|
|
|
radius: 0.0,
|
|
|
|
thumbnailOnly: false,
|
|
|
|
),
|
|
|
|
),
|
2020-05-16 08:02:33 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|