TF-1886 Support RTL mode for HTML display
(cherry picked from commit 9ac393489e746b49073b1a2d98063481f4c894c6)
This commit is contained in:
@@ -447,11 +447,13 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
|
||||
if (BuildUtils.isWeb) {
|
||||
return HtmlContentViewerOnWeb(
|
||||
widthContent: constraints.maxWidth,
|
||||
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
||||
contentHtml: allEmailContents ?? "",
|
||||
controller: HtmlViewerControllerForWeb(),
|
||||
mailtoDelegate: (uri) => controller.openMailToLink(uri));
|
||||
widthContent: constraints.maxWidth,
|
||||
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
||||
contentHtml: allEmailContents ?? "",
|
||||
controller: HtmlViewerControllerForWeb(),
|
||||
mailtoDelegate: (uri) => controller.openMailToLink(uri),
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
);
|
||||
} else {
|
||||
return HtmlContentViewer(
|
||||
heightContent: responsiveUtils.getSizeScreenHeight(context),
|
||||
@@ -462,6 +464,7 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
log('EmailView::_buildEmailContent(): isScrollPageViewActivated: $isScrollPageViewActivated');
|
||||
controller.emailSupervisorController.updateScrollPhysicPageView(isScrollPageViewActivated: isScrollPageViewActivated);
|
||||
},
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
+7
-4
@@ -3,6 +3,7 @@ import 'package:core/presentation/views/html_viewer/html_content_viewer_widget.d
|
||||
import 'package:core/presentation/views/html_viewer/html_viewer_controller_for_web.dart';
|
||||
import 'package:core/utils/build_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_utils.dart';
|
||||
|
||||
class SignatureBuilder extends StatelessWidget {
|
||||
|
||||
@@ -27,13 +28,13 @@ class SignatureBuilder extends StatelessWidget {
|
||||
width: signatureWidth,
|
||||
color: Colors.white,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 16.0),
|
||||
child: _buildSignature(signatureWidth, signatureHeight),
|
||||
child: _buildSignature(context, signatureWidth, signatureHeight),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSignature(double width, double height) {
|
||||
Widget _buildSignature(BuildContext context, double width, double height) {
|
||||
if (signatureSelected.isNotEmpty) {
|
||||
if (BuildUtils.isWeb) {
|
||||
return HtmlContentViewerOnWeb(
|
||||
@@ -41,12 +42,14 @@ class SignatureBuilder extends StatelessWidget {
|
||||
widthContent: width,
|
||||
heightContent: height,
|
||||
controller: HtmlViewerControllerForWeb(),
|
||||
allowResizeToDocumentSize: false
|
||||
allowResizeToDocumentSize: false,
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
);
|
||||
} else {
|
||||
return HtmlContentViewer(
|
||||
contentHtml: signatureSelected,
|
||||
heightContent: height
|
||||
heightContent: height,
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -33,6 +33,9 @@ class AppUtils {
|
||||
return intl.Bidi.isRtlLanguage(Localizations.localeOf(context).languageCode);
|
||||
}
|
||||
|
||||
static TextDirection getCurrentDirection(BuildContext context) =>
|
||||
isDirectionRTL(context) ? TextDirection.rtl : TextDirection.ltr;
|
||||
|
||||
static bool isEmailLocalhost(String email) {
|
||||
return RegExp(r'^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@localhost$').hasMatch(email);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user