TF-1521 Fix can not scroll to see long email body

This commit is contained in:
dab246
2023-03-03 18:33:38 +07:00
committed by Dat Vu
parent e83014ad82
commit 9ced9b6491
@@ -1,6 +1,5 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'dart:ui';
import 'package:core/presentation/extensions/color_extension.dart'; import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/utils/html_transformer/html_event_action.dart'; import 'package:core/presentation/utils/html_transformer/html_event_action.dart';
@@ -55,7 +54,6 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
late double actualHeight; late double actualHeight;
double minHeight = 100; double minHeight = 100;
double minWidth = 300; double minWidth = 300;
late double maxHeightForAndroid;
String? _htmlData; String? _htmlData;
late InAppWebViewController _webViewController; late InAppWebViewController _webViewController;
bool _isLoading = true; bool _isLoading = true;
@@ -65,7 +63,6 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
void initState() { void initState() {
super.initState(); super.initState();
actualHeight = widget.heightContent; actualHeight = widget.heightContent;
maxHeightForAndroid = window.physicalSize.height;
_htmlData = generateHtml(widget.contentHtml); _htmlData = generateHtml(widget.contentHtml);
} }
@@ -162,12 +159,7 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
final scrollHeightWithBuffer = scrollHeight + 30.0; final scrollHeightWithBuffer = scrollHeight + 30.0;
if (scrollHeightWithBuffer > minHeight) { if (scrollHeightWithBuffer > minHeight) {
setState(() { setState(() {
// It hotfix for web_view crash on android device and waiting lib web_view update to fix this issue actualHeight = scrollHeightWithBuffer;
if (Platform.isAndroid && scrollHeightWithBuffer > maxHeightForAndroid){
actualHeight = maxHeightForAndroid;
} else {
actualHeight = scrollHeightWithBuffer;
}
_isLoading = false; _isLoading = false;
}); });
} else { } else {