refactor: Magic numbers

This commit is contained in:
Krille Fear 2021-10-26 18:47:05 +02:00
commit f114d545f7
8 changed files with 63 additions and 54 deletions

View file

@ -27,11 +27,13 @@ class ImageViewerController extends State<ImageViewer> {
/// Save this file with a system call.
void saveFileAction() => widget.event.saveFile(context);
static const maxScaleFactor = 1.5;
/// Go back if user swiped it away
void onInteractionEnds(ScaleEndDetails endDetails) {
if (PlatformInfos.usesTouchscreen == false) {
if (endDetails.velocity.pixelsPerSecond.dy >
MediaQuery.of(context).size.height * 1.50) {
MediaQuery.of(context).size.height * maxScaleFactor) {
Navigator.of(context, rootNavigator: false).pop();
}
}