Skip to content

Commit

Permalink
Fix Html attachment previewer on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
tddang-linagora committed Jan 22, 2025
1 parent 04d7ead commit da6a244
Showing 1 changed file with 24 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

import 'package:core/presentation/utils/responsive_utils.dart';
import 'package:core/presentation/views/html_viewer/html_content_viewer_on_web_widget.dart';
import 'package:core/presentation/views/html_viewer/html_content_viewer_widget.dart';
import 'package:core/presentation/views/responsive/responsive_widget.dart';
import 'package:core/utils/platform_info.dart';
import 'package:flutter/material.dart';
import 'package:pointer_interceptor/pointer_interceptor.dart';
import 'package:tmail_ui_user/features/email/presentation/widgets/pdf_viewer/top_bar_attachment_viewer.dart';
Expand Down Expand Up @@ -79,21 +80,31 @@ class HtmlAttachmentPreviewer extends StatelessWidget {
);
}

HtmlContentViewerOnWeb _buildHtmlViewerWith(
Widget _buildHtmlViewerWith(
BuildContext context, {
required double width,
required double height,
}) {
return HtmlContentViewerOnWeb(
contentHtml: htmlContent,
widthContent: width,
heightContent: height,
direction: AppUtils.getCurrentDirection(context),
mailtoDelegate: (uri) {
popBack();
mailToClicked(uri);
},
keepWidthWhileLoading: true,
);
return PlatformInfo.isWeb
? HtmlContentViewerOnWeb(
contentHtml: htmlContent,
widthContent: width,
heightContent: height,
direction: AppUtils.getCurrentDirection(context),
mailtoDelegate: (uri) {
popBack();
mailToClicked(uri);
},
keepWidthWhileLoading: true,
)
: HtmlContentViewer(
contentHtml: htmlContent,
initialWidth: width,
direction: AppUtils.getCurrentDirection(context),
onMailtoDelegateAction: (uri) async {
popBack();
mailToClicked(uri);
},
);
}
}

0 comments on commit da6a244

Please sign in to comment.