fix: add try-catch to _measureHeight() in secure_email_webview.dart (#345)
This commit was merged in pull request #345.
This commit is contained in:
@@ -111,12 +111,16 @@ class _SecureEmailWebViewState extends State<SecureEmailWebView> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Future<void> _measureHeight(String _) async {
|
Future<void> _measureHeight(String _) async {
|
||||||
final result = await _controller!.runJavaScriptReturningResult(
|
try {
|
||||||
'document.documentElement.scrollHeight',
|
final result = await _controller!.runJavaScriptReturningResult(
|
||||||
);
|
'document.documentElement.scrollHeight',
|
||||||
final h = double.tryParse(result.toString());
|
);
|
||||||
if (h != null && h > 0 && mounted) {
|
final h = double.tryParse(result.toString());
|
||||||
setState(() => _height = h);
|
if (h != null && h > 0 && mounted) {
|
||||||
|
setState(() => _height = h);
|
||||||
|
}
|
||||||
|
} catch (_) {
|
||||||
|
// WebView not ready yet; height stays at default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user