fix: replace image zoom packages
This commit is contained in:
parent
9f1f6ad0ff
commit
27dbbb9221
3 changed files with 41 additions and 12 deletions
|
@ -1,3 +1,5 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:html/parser.dart';
|
||||
|
@ -7,7 +9,7 @@ import 'package:voyagehandbook/api/classes.dart';
|
|||
import 'package:voyagehandbook/util/styles.dart';
|
||||
import 'package:voyagehandbook/util/widgets/warning.dart';
|
||||
import 'package:html_unescape/html_unescape_small.dart';
|
||||
import 'package:zoom_pinch_overlay/zoom_pinch_overlay.dart';
|
||||
import 'package:widget_zoom/widget_zoom.dart';
|
||||
|
||||
/*
|
||||
Voyage Handbook - The open-source WikiVoyage reader
|
||||
|
@ -275,6 +277,32 @@ class PageRenderer {
|
|||
height: 10,
|
||||
),
|
||||
);
|
||||
} else if (element.id == "thumbinner") {
|
||||
var imgs = element.getElementsByTagName("img");
|
||||
if (imgs.isEmpty) break;
|
||||
var img = imgs[0];
|
||||
var cap = element.getElementsByClassName("thumbcaption")[0];
|
||||
out.add(const SizedBox(
|
||||
height: 10,
|
||||
));
|
||||
out.add(
|
||||
SizedBox(
|
||||
width: width * 0.8,
|
||||
height: height * 0.3,
|
||||
child: WidgetZoom(
|
||||
zoomWidget:
|
||||
CachedNetworkImage(imageUrl: img.attributes["src"]!),
|
||||
heroAnimationTag: 'tag',
|
||||
),
|
||||
),
|
||||
);
|
||||
out.add(const SizedBox(
|
||||
height: 3,
|
||||
));
|
||||
out.add(Text(cap.text));
|
||||
out.add(const SizedBox(
|
||||
height: 10,
|
||||
));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -312,8 +340,9 @@ class PageRenderer {
|
|||
// TODO: open wikimedia page?
|
||||
width: width * 0.8,
|
||||
height: height * 0.3,
|
||||
child: ZoomOverlay(
|
||||
child: CachedNetworkImage(
|
||||
child: WidgetZoom(
|
||||
heroAnimationTag: 'img${Random().nextInt(999)}',
|
||||
zoomWidget: CachedNetworkImage(
|
||||
imageUrl: img.attributes["src"]!.replaceAll("//", "https://"),
|
||||
progressIndicatorBuilder: (context, url, downloadProgress) =>
|
||||
LinearProgressIndicator(value: downloadProgress.progress),
|
||||
|
|
16
pubspec.lock
16
pubspec.lock
|
@ -909,6 +909,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.0"
|
||||
widget_zoom:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: widget_zoom
|
||||
sha256: f7c7352b5ea1f08e9419edddd938852239ad4c94ee70d29b5b5f142b04cb8eca
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.0.1"
|
||||
win32:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -941,14 +949,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
zoom_pinch_overlay:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: zoom_pinch_overlay
|
||||
sha256: cad0aef0127953e3a2ad65aa51660e9c86fa11906e286297f9a70aab69163f64
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.1+3"
|
||||
sdks:
|
||||
dart: ">=2.19.4 <3.0.0"
|
||||
flutter: ">=3.4.0-17.0.pre"
|
||||
|
|
|
@ -45,7 +45,7 @@ dependencies:
|
|||
url_launcher: ^6.1.10
|
||||
cached_network_image: ^3.2.3
|
||||
html_unescape: ^2.0.0
|
||||
zoom_pinch_overlay: ^1.4.1+3
|
||||
widget_zoom: ^0.0.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
Loading…
Reference in a new issue