Skip to content

Commit

Permalink
Merge pull request #267 from humhub/f-internal-72-zoom-out
Browse files Browse the repository at this point in the history
Implement zoomOut
  • Loading branch information
marc-farre authored Jan 9, 2025
2 parents da465de + 9d3bc6f commit 0e0eb52
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/app_opener.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:humhub/util/const.dart';
import 'package:humhub/util/intent/intent_plugin.dart';
Expand Down
11 changes: 10 additions & 1 deletion lib/util/web_view_global_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ class WebViewGlobalController {

_value?.addJavaScriptHandler(
handlerName: 'onImageClosed',
callback: (args) {
callback: (args) async {
if (!opened) return;
opened = false;
zoomOut();
_value?.setSettings(settings: settings(zoom: opened));
},
);
Expand All @@ -129,6 +130,14 @@ class WebViewGlobalController {
""");
}

static Future<void> zoomOut() async {
bool? canZoomOut = true;
while (canZoomOut ?? false) {
canZoomOut = await value?.zoomOut();
}
}


static InAppWebViewSettings settings({bool zoom = false}) {
return InAppWebViewSettings(
useShouldOverrideUrlLoading: true,
Expand Down

0 comments on commit 0e0eb52

Please sign in to comment.