Fix long email content is cut off on android
Signed-off-by: dab246 <tdvu@linagora.com> (cherry picked from commit cb53edf0eed467b40fefa85f7390dc3f5cfa6c35)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'dart:collection';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -34,7 +35,7 @@ class EmailSupervisorController extends GetxController {
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
updateScrollPhysicPageView();
|
||||
updateScrollPhysicPageView(false);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -69,7 +70,7 @@ class EmailSupervisorController extends GetxController {
|
||||
}
|
||||
|
||||
void onPageChanged(int index) {
|
||||
updateScrollPhysicPageView();
|
||||
updateScrollPhysicPageView(false);
|
||||
mailboxDashBoardController.openEmailDetailedView(currentListEmail[index]);
|
||||
}
|
||||
|
||||
@@ -122,7 +123,8 @@ class EmailSupervisorController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void updateScrollPhysicPageView({bool isScrollPageViewActivated = false}) {
|
||||
void updateScrollPhysicPageView(bool isScrollPageViewActivated) {
|
||||
log('EmailSupervisorController::updateScrollPhysicPageView:isScrollPageViewActivated: $isScrollPageViewActivated');
|
||||
if (PlatformInfo.isWeb || !isScrollPageViewActivated) {
|
||||
scrollPhysicsPageView.value = const NeverScrollableScrollPhysics();
|
||||
} else {
|
||||
|
||||
@@ -121,105 +121,101 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
}
|
||||
}),
|
||||
Expanded(
|
||||
child: LayoutBuilder(builder: (context, constraints) {
|
||||
return Obx(() {
|
||||
if (controller.emailSupervisorController.supportedPageView.isTrue) {
|
||||
final currentListEmail = controller.emailSupervisorController.currentListEmail;
|
||||
return PageView.builder(
|
||||
physics: controller.emailSupervisorController.scrollPhysicsPageView.value,
|
||||
itemCount: currentListEmail.length,
|
||||
allowImplicitScrolling: true,
|
||||
controller: controller.emailSupervisorController.pageController,
|
||||
onPageChanged: controller.emailSupervisorController.onPageChanged,
|
||||
itemBuilder: (context, index) {
|
||||
final currentEmail = currentListEmail[index];
|
||||
if (PlatformInfo.isMobile) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: Obx(() => _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: controller.calendarEvent.value,
|
||||
maxHeight: constraints.maxHeight
|
||||
))
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return Obx(() {
|
||||
final calendarEvent = controller.calendarEvent.value;
|
||||
if (currentEmail.hasCalendarEvent && calendarEvent != null) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: calendarEvent,
|
||||
emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(),
|
||||
)
|
||||
child: Obx(() {
|
||||
if (controller.emailSupervisorController.supportedPageView.isTrue) {
|
||||
final currentListEmail = controller.emailSupervisorController.currentListEmail;
|
||||
return PageView.builder(
|
||||
physics: controller.emailSupervisorController.scrollPhysicsPageView.value,
|
||||
itemCount: currentListEmail.length,
|
||||
allowImplicitScrolling: true,
|
||||
controller: controller.emailSupervisorController.pageController,
|
||||
onPageChanged: controller.emailSupervisorController.onPageChanged,
|
||||
itemBuilder: (context, index) {
|
||||
final currentEmail = currentListEmail[index];
|
||||
if (PlatformInfo.isMobile) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: Obx(() => _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: controller.calendarEvent.value,
|
||||
))
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return Obx(() {
|
||||
final calendarEvent = controller.calendarEvent.value;
|
||||
if (currentEmail.hasCalendarEvent && calendarEvent != null) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: calendarEvent,
|
||||
emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
} else {
|
||||
if (PlatformInfo.isMobile) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: Obx(() => _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: controller.calendarEvent.value,
|
||||
))
|
||||
)
|
||||
);
|
||||
} else {
|
||||
if (PlatformInfo.isMobile) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: Obx(() => _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: controller.calendarEvent.value,
|
||||
maxHeight: constraints.maxHeight
|
||||
))
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return Obx(() {
|
||||
final calendarEvent = controller.calendarEvent.value;
|
||||
if (currentEmail.hasCalendarEvent && calendarEvent != null) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: calendarEvent,
|
||||
emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(),
|
||||
)
|
||||
return Obx(() {
|
||||
final calendarEvent = controller.calendarEvent.value;
|
||||
if (currentEmail.hasCalendarEvent && calendarEvent != null) {
|
||||
return SingleChildScrollView(
|
||||
physics : const ClampingScrollPhysics(),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
color: Colors.white,
|
||||
child: _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
calendarEvent: calendarEvent,
|
||||
emailAddressSender: currentEmail.listEmailAddressSender.getListAddress(),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
)
|
||||
);
|
||||
} else {
|
||||
return _buildEmailMessage(
|
||||
context: context,
|
||||
presentationEmail: currentEmail,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}),
|
||||
),
|
||||
EmailViewBottomBarWidget(
|
||||
@@ -306,7 +302,6 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
required PresentationEmail presentationEmail,
|
||||
CalendarEvent? calendarEvent,
|
||||
List<String>? emailAddressSender,
|
||||
double? maxHeight,
|
||||
}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -410,17 +405,16 @@ class EmailView extends GetWidget<SingleEmailController> {
|
||||
vertical: EmailViewStyles.mobileContentVerticalMargin,
|
||||
horizontal: EmailViewStyles.mobileContentHorizontalMargin
|
||||
),
|
||||
child: HtmlContentViewer(
|
||||
contentHtml: allEmailContents,
|
||||
heightContent: maxHeight,
|
||||
mailtoDelegate: controller.openMailToLink,
|
||||
onScrollHorizontalEnd: controller.toggleScrollPhysicsPagerView,
|
||||
onWebViewLoaded: (isScrollPageViewActivated) {
|
||||
log('EmailView::_buildEmailContent(): isScrollPageViewActivated: $isScrollPageViewActivated');
|
||||
controller.emailSupervisorController.updateScrollPhysicPageView(isScrollPageViewActivated: isScrollPageViewActivated);
|
||||
},
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
),
|
||||
child: LayoutBuilder(builder: (context, constraints) {
|
||||
return HtmlContentViewer(
|
||||
contentHtml: allEmailContents,
|
||||
initialWidth: constraints.maxWidth,
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
onMailtoDelegateAction: controller.openMailToLink,
|
||||
onScrollHorizontalEnd: controller.toggleScrollPhysicsPagerView,
|
||||
onLoadWidthHtmlViewer: controller.emailSupervisorController.updateScrollPhysicPageView,
|
||||
);
|
||||
})
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
+7
-5
@@ -46,11 +46,13 @@ class SignatureBuilder extends StatelessWidget {
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
);
|
||||
} else {
|
||||
return HtmlContentViewer(
|
||||
contentHtml: signatureSelected,
|
||||
heightContent: height,
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
);
|
||||
return LayoutBuilder(builder: (context, constraints) {
|
||||
return HtmlContentViewer(
|
||||
contentHtml: signatureSelected,
|
||||
initialWidth: constraints.maxWidth,
|
||||
direction: AppUtils.getCurrentDirection(context),
|
||||
);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return SizedBox(width: width, height: height);
|
||||
|
||||
Reference in New Issue
Block a user