mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 14:59:29 +01:00
Merge branch 'change-photo-viewer' into 'main'
feat: Add vertical swipe down to dismiss photo viewer Closes #89 See merge request famedly/fluffychat!342
This commit is contained in:
commit
81419942dd
@ -3,8 +3,8 @@ import 'package:famedlysdk/famedlysdk.dart';
|
|||||||
import 'package:fluffychat/components/image_bubble.dart';
|
import 'package:fluffychat/components/image_bubble.dart';
|
||||||
import 'package:fluffychat/components/matrix.dart';
|
import 'package:fluffychat/components/matrix.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:photo_view/photo_view.dart';
|
|
||||||
import '../utils/event_extension.dart';
|
import '../utils/event_extension.dart';
|
||||||
|
import '../utils/platform_infos.dart';
|
||||||
|
|
||||||
class ImageView extends StatelessWidget {
|
class ImageView extends StatelessWidget {
|
||||||
final Event event;
|
final Event event;
|
||||||
@ -19,6 +19,8 @@ class ImageView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
var calcVelocity = MediaQuery.of(context).size.height * 1.50;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
@ -43,9 +45,8 @@ class ImageView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: PhotoView.customChild(
|
body: InteractiveViewer(
|
||||||
minScale: 1.0,
|
child: Center(
|
||||||
maxScale: 10.0,
|
|
||||||
child: ImageBubble(
|
child: ImageBubble(
|
||||||
event,
|
event,
|
||||||
tapToView: false,
|
tapToView: false,
|
||||||
@ -57,6 +58,16 @@ class ImageView extends StatelessWidget {
|
|||||||
thumbnailOnly: false,
|
thumbnailOnly: false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
minScale: 1.0,
|
||||||
|
maxScale: 10.0,
|
||||||
|
onInteractionEnd: (ScaleEndDetails endDetails) {
|
||||||
|
if (PlatformInfos.usesTouchscreen == false) {
|
||||||
|
if (endDetails.velocity.pixelsPerSecond.dy > calcVelocity) {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user