Fix display content full screen in Email Detailed
This commit is contained in:
@@ -108,6 +108,7 @@ extension AppColor on Color {
|
||||
static const colorFocusButton = Color(0x14818C99);
|
||||
static const colorBorderEmailAddressInvalid = Color(0xFFFF3347);
|
||||
static const colorBgMailboxSelected = Color(0xFF99E4E8EC);
|
||||
static const colorLoading = Color(0x2999A2AD);
|
||||
|
||||
static const mapGradientColor = [
|
||||
[Color(0xFF21D4FD), Color(0xFFB721FF)],
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'package:core/data/network/dio_client.dart';
|
||||
import 'package:core/presentation/utils/html_transformer/base/dom_transformer.dart';
|
||||
import 'package:html/dom.dart';
|
||||
|
||||
import '../html_template.dart';
|
||||
|
||||
class AddTooltipLinkTransformer extends DomTransformer {
|
||||
|
||||
const AddTooltipLinkTransformer();
|
||||
@@ -29,7 +31,7 @@ class AddTooltipLinkTransformer extends DomTransformer {
|
||||
if (children.isEmpty && text.isNotEmpty && url != null) {
|
||||
final innerHtml = element.innerHtml;
|
||||
final tagClass = element.attributes['class'];
|
||||
element.attributes['class'] = '$tagClass tooltip';
|
||||
element.attributes['class'] = '$tagClass $nameClassToolTip';
|
||||
element.innerHtml = innerHtml + textHasToolTip(url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
final nameClassToolTip = 'tmail-tooltip';
|
||||
|
||||
final tooltipLinkCss = '''
|
||||
.tooltip .tooltiptext {
|
||||
.$nameClassToolTip .tooltiptext {
|
||||
visibility: hidden;
|
||||
max-width: 400px;
|
||||
background-color: black;
|
||||
@@ -14,7 +16,7 @@ final tooltipLinkCss = '''
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
}
|
||||
.tooltip:hover .tooltiptext {
|
||||
.$nameClassToolTip:hover .tooltiptext {
|
||||
visibility: visible;
|
||||
}
|
||||
''';
|
||||
|
||||
@@ -6,7 +6,7 @@ import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/utils/html_transformer/html_template.dart';
|
||||
import 'package:core/presentation/views/html_viewer/html_viewer_controller_for_web.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
import 'package:core/presentation/utils/shims/dart_ui.dart' as ui;
|
||||
|
||||
@@ -227,7 +227,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
|
||||
width: actualWidth,
|
||||
child: _buildWebView(),
|
||||
),
|
||||
if (_isLoading) Align(alignment: Alignment.center, child: _buildLoadingView())
|
||||
if (_isLoading) Align(alignment: Alignment.topCenter, child: _buildLoadingView())
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ class _HtmlContentViewerOnWebState extends State<HtmlContentViewerOnWeb> {
|
||||
child: SizedBox(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: CircularProgressIndicator(color: AppColor.colorTextButton)));
|
||||
child: CupertinoActivityIndicator(color: AppColor.colorLoading)));
|
||||
}
|
||||
|
||||
Widget _buildWebView() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -11,8 +12,7 @@ import 'dart:developer' as developer;
|
||||
class HtmlContentViewer extends StatefulWidget {
|
||||
|
||||
final String contentHtml;
|
||||
final double widthContent;
|
||||
final Widget? loadingWidget;
|
||||
final double heightContent;
|
||||
|
||||
/// Register this callback if you want a reference to the [WebViewController].
|
||||
final void Function(WebViewController controller)? onCreated;
|
||||
@@ -28,8 +28,7 @@ class HtmlContentViewer extends StatefulWidget {
|
||||
const HtmlContentViewer({
|
||||
Key? key,
|
||||
required this.contentHtml,
|
||||
required this.widthContent,
|
||||
this.loadingWidget,
|
||||
required this.heightContent,
|
||||
this.onCreated,
|
||||
this.urlLauncherDelegate,
|
||||
this.mailtoDelegate,
|
||||
@@ -41,8 +40,7 @@ class HtmlContentViewer extends StatefulWidget {
|
||||
|
||||
class _HtmlContentViewState extends State<HtmlContentViewer> {
|
||||
|
||||
double? _webViewHeight = 1.0;
|
||||
double? _webViewWidth = 1.0;
|
||||
late double actualHeight;
|
||||
double minHeight = 100;
|
||||
double minWidth = 300;
|
||||
String? _htmlData;
|
||||
@@ -52,7 +50,7 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_webViewWidth = widget.widthContent;
|
||||
actualHeight = widget.heightContent;
|
||||
_htmlData = _generateHtmlDocument(widget.contentHtml);
|
||||
}
|
||||
|
||||
@@ -63,29 +61,27 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: _webViewHeight,
|
||||
width: _webViewWidth,
|
||||
child: _buildWebView(),
|
||||
),
|
||||
if (_isLoading) Align(alignment: Alignment.center, child: _buildLoadingView())
|
||||
],
|
||||
);
|
||||
return LayoutBuilder(builder: (context, constraints) {
|
||||
log('_HtmlContentViewState::build(): maxWidth: ${constraints.maxWidth}');
|
||||
return Stack(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: actualHeight,
|
||||
width: constraints.maxWidth,
|
||||
child: _buildWebView()),
|
||||
if (_isLoading) Align(alignment: Alignment.center, child: _buildLoadingView())
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildLoadingView() {
|
||||
if (widget.loadingWidget != null) {
|
||||
return widget.loadingWidget!;
|
||||
} else {
|
||||
return Padding(
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: SizedBox(
|
||||
width: 30,
|
||||
height: 30,
|
||||
child: CircularProgressIndicator(color: AppColor.primaryColor)));
|
||||
}
|
||||
child: CupertinoActivityIndicator(color: AppColor.colorLoading)));
|
||||
}
|
||||
|
||||
Widget _buildWebView() {
|
||||
@@ -110,7 +106,7 @@ class _HtmlContentViewState extends State<HtmlContentViewer> {
|
||||
final scrollHeightWithBuffer = scrollHeight + 30.0;
|
||||
if (scrollHeightWithBuffer > minHeight) {
|
||||
setState(() {
|
||||
_webViewHeight = scrollHeightWithBuffer;
|
||||
actualHeight = scrollHeightWithBuffer;
|
||||
_isLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user