TF-1961 Add script handle lazy loading image in html
(cherry picked from commit b57c93f47dc7c621e24506818d44b6360a9b9239)
This commit is contained in:
@@ -4,6 +4,7 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/utils/html_transformer/html_template.dart';
|
||||
import 'package:core/presentation/utils/html_transformer/html_utils.dart';
|
||||
import 'package:core/presentation/views/html_viewer/html_viewer_controller_for_web.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -171,7 +172,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
|
||||
minHeight: minHeight,
|
||||
minWidth: minWidth,
|
||||
styleCSS: tooltipLinkCss,
|
||||
javaScripts: webViewActionScripts + scriptsDisableZoom,
|
||||
javaScripts: webViewActionScripts + scriptsDisableZoom + HtmlUtils.scriptLazyLoadImage,
|
||||
direction: widget.direction);
|
||||
|
||||
return htmlTemplate;
|
||||
|
||||
@@ -65,7 +65,11 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
actualHeight = widget.heightContent;
|
||||
_htmlData = generateHtml(widget.contentHtml, direction: widget.direction);
|
||||
_htmlData = generateHtml(
|
||||
widget.contentHtml,
|
||||
direction: widget.direction,
|
||||
javaScripts: HtmlUtils.scriptLazyLoadImage,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -76,7 +80,8 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
|
||||
widget.direction != oldWidget.direction) {
|
||||
_htmlData = generateHtml(
|
||||
widget.contentHtml,
|
||||
direction: widget.direction
|
||||
direction: widget.direction,
|
||||
javaScripts: HtmlUtils.scriptLazyLoadImage,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -176,8 +181,6 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
|
||||
actualHeight = minHeight;
|
||||
}
|
||||
}
|
||||
|
||||
return Future.value(null);
|
||||
}
|
||||
|
||||
Future<void> _setActualWidthView() async {
|
||||
@@ -210,8 +213,6 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
|
||||
widget.onWebViewLoaded?.call(isScrollActivated);
|
||||
}
|
||||
}
|
||||
|
||||
return Future.value(null);
|
||||
}
|
||||
|
||||
void _hideLoadingProgress() {
|
||||
|
||||
Reference in New Issue
Block a user