diff --git a/core/lib/presentation/views/html_viewer/html_content_viewer_widget.dart b/core/lib/presentation/views/html_viewer/html_content_viewer_widget.dart
index 5912dfcd9..36f6b39d6 100644
--- a/core/lib/presentation/views/html_viewer/html_content_viewer_widget.dart
+++ b/core/lib/presentation/views/html_viewer/html_content_viewer_widget.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'dart:io';
import 'package:core/core.dart';
import 'package:flutter/cupertino.dart';
@@ -43,6 +44,7 @@ class _HtmlContentViewState extends State {
late double actualHeight;
double minHeight = 100;
double minWidth = 300;
+ final double maxHeightForAndroid = 6000;
String? _htmlData;
late WebViewController _webViewController;
bool _isLoading = true;
@@ -99,18 +101,23 @@ class _HtmlContentViewState extends State {
widget.onCreated?.call(controller);
},
onPageFinished: (url) async {
- final scrollHeightText = await _webViewController.runJavascriptReturningResult('document.body.scrollHeight');
- final scrollHeight = double.tryParse(scrollHeightText);
- developer.log('onPageFinished(): scrollHeightText: $scrollHeightText', name: 'HtmlContentViewer');
- if ((scrollHeight != null) && mounted) {
- final scrollHeightWithBuffer = scrollHeight + 30.0;
- if (scrollHeightWithBuffer > minHeight) {
- setState(() {
- actualHeight = scrollHeightWithBuffer;
- _isLoading = false;
- });
+ final scrollHeightText = await _webViewController.runJavascriptReturningResult('document.body.scrollHeight');
+ final scrollHeight = double.tryParse(scrollHeightText);
+ developer.log('onPageFinished(): scrollHeightText: $scrollHeightText', name: 'HtmlContentViewer');
+ if ((scrollHeight != null) && mounted) {
+ final scrollHeightWithBuffer = scrollHeight + 30.0;
+ if (scrollHeightWithBuffer > minHeight) {
+ setState(() {
+ //TODO: It hotfix for web_view crash on android device and waiting lib web_view update to fix this issue
+ if(Platform.isAndroid && scrollHeightWithBuffer > maxHeightForAndroid){
+ actualHeight = maxHeightForAndroid;
+ } else {
+ actualHeight = scrollHeightWithBuffer;
+ }
+ _isLoading = false;
+ });
+ }
}
- }
if (mounted && _isLoading) {
setState(() {
_isLoading = false;
diff --git a/docs/adr/0009-on-before-unload-not-support-indexed-db.md b/docs/adr/0009-on-before-unload-not-support-indexed-db.md
index 5af4a1275..464d38e24 100644
--- a/docs/adr/0009-on-before-unload-not-support-indexed-db.md
+++ b/docs/adr/0009-on-before-unload-not-support-indexed-db.md
@@ -1,4 +1,4 @@
-# 8. Unable to save data to indexedDB in onBeforeUnload state of web
+# 9. Unable to save data to indexedDB in onBeforeUnload state of web
Date: 2022-07-11
diff --git a/docs/adr/0010-crash-app-when-open-webview-on-android-device.md b/docs/adr/0010-crash-app-when-open-webview-on-android-device.md
new file mode 100644
index 000000000..41264013c
--- /dev/null
+++ b/docs/adr/0010-crash-app-when-open-webview-on-android-device.md
@@ -0,0 +1,31 @@
+# 10. Crash app when open web_view on android device
+
+Date: 2022-07-20
+
+## Status
+
+Open
+
+## Context
+
+- When using a webview inside of a scrollview,
+some content renders a completely distorted page and some content even crashes the app.
+This problem only affects Android the same app, on iOS the same code results in a correclty rendered web page.
+Rendering the same content also works fine on Android, when not embedding the webview inside of a scrollview.
+
+- Flutter version has problem: 3.0.3
+
+## Decision
+
+- When using a webview inside of a scrollview,
+some content renders a completely distorted page and some content even crashes the app.
+This problem only affects Android the same app, on iOS the same code results in a correclty rendered web page.
+Rendering the same content also works fine on Android, when not embedding the webview inside of a scrollview.
+
+## Consequences
+
+- From now we waiting web_view lib update and for android device if content of web_view has max height is 6000,
+
+## Reference
+
+- [Issue detail](https://github.com/flutter/flutter/issues/104889)