Remove widget unnecessary

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-07-24 12:32:07 +07:00
committed by Dat H. Pham
parent 9b5fa6ce3f
commit 2ebde9271b
4 changed files with 56 additions and 86 deletions
@@ -218,16 +218,11 @@ class EmailView extends GetWidget<SingleEmailController> {
); );
if (PlatformInfo.isMobile) { if (PlatformInfo.isMobile) {
return ColoredBox( return SafeArea(
color: controller.responsiveUtils.isWebDesktop(context) right: controller.responsiveUtils.isLandscapeMobile(context),
? AppColor.colorBgDesktop left: controller.responsiveUtils.isLandscapeMobile(context),
: Colors.white, bottom: !PlatformInfo.isIOS,
child: SafeArea( child: bodyWidget,
right: controller.responsiveUtils.isLandscapeMobile(context),
left: controller.responsiveUtils.isLandscapeMobile(context),
bottom: !PlatformInfo.isIOS,
child: bodyWidget,
),
); );
} else { } else {
return bodyWidget; return bodyWidget;
@@ -235,14 +230,9 @@ class EmailView extends GetWidget<SingleEmailController> {
} }
BoxDecoration _getDecorationEmailView(BuildContext context) { BoxDecoration _getDecorationEmailView(BuildContext context) {
if (controller.responsiveUtils.isWebDesktop(context) && !isInsideThreadDetailView) { if ((controller.responsiveUtils.isWebDesktop(context) && !isInsideThreadDetailView) ||
return const BoxDecoration( controller.currentEmail == null ||
borderRadius: BorderRadius.all(Radius.circular(20)), isFirstEmailInThreadDetail) {
color: Colors.white,
);
}
if (controller.currentEmail == null || isFirstEmailInThreadDetail) {
return const BoxDecoration(color: Colors.white); return const BoxDecoration(color: Colors.white);
} }
@@ -73,10 +73,6 @@ class EmailViewAppBarWidget extends StatelessWidget {
width: EmailViewAppBarWidgetStyles.bottomBorderWidth, width: EmailViewAppBarWidgetStyles.bottomBorderWidth,
) )
), ),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(EmailViewAppBarWidgetStyles.radius),
topRight: Radius.circular(EmailViewAppBarWidgetStyles.radius),
),
color: EmailViewAppBarWidgetStyles.backgroundColor, color: EmailViewAppBarWidgetStyles.backgroundColor,
), ),
child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [ child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
@@ -97,17 +97,23 @@ class ThreadDetailView extends GetWidget<ThreadDetailController> {
); );
}), }),
Obx(() { Obx(() {
final threadChildren = controller.getThreadDetailEmailViews();
late Widget threadBody;
if (threadChildren.length == 1) {
threadBody = threadChildren.first;
} else {
threadBody = Column(
mainAxisSize: MainAxisSize.min,
children: threadChildren,
);
}
final nonPageViewThread = Expanded( final nonPageViewThread = Expanded(
child: Container( child: SingleChildScrollView(
color: Colors.white, controller: controller.scrollController,
padding: _padding(context), child: threadBody,
child: SingleChildScrollView(
controller: controller.scrollController,
child: Column(
mainAxisSize: MainAxisSize.min,
children: controller.getThreadDetailEmailViews()
),
),
), ),
); );
@@ -127,13 +133,7 @@ class ThreadDetailView extends GetWidget<ThreadDetailController> {
if (index != currentIndex) { if (index != currentIndex) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
return SingleChildScrollView(child: threadBody);
return SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: controller.getThreadDetailEmailViews()
),
);
}, },
onPageChanged: controller.onThreadPageChanged, onPageChanged: controller.onThreadPageChanged,
), ),
@@ -157,42 +157,30 @@ class ThreadDetailView extends GetWidget<ThreadDetailController> {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
return Padding( return EmailViewBottomBarWidget(
padding: controller.responsiveUtils.isDesktop(context) key: const Key('email_view_button_bar'),
? const EdgeInsetsDirectional.only(end: 16) imagePaths: controller.imagePaths,
: EdgeInsets.zero, responsiveUtils: controller.responsiveUtils,
child: ClipRRect( emailLoaded: currentEmailLoaded,
borderRadius: const BorderRadius.vertical( presentationEmail: expandedPresentationEmail,
bottom: Radius.circular(20), userName: controller.session?.getOwnEmailAddress() ?? '',
), emailActionCallback: (action, email) {
child: EmailViewBottomBarWidget( controller.mailboxDashBoardController
key: const Key('email_view_button_bar'), ..dispatchEmailUIAction(PerformEmailActionInThreadDetailAction(
imagePaths: controller.imagePaths, emailActionType: action,
responsiveUtils: controller.responsiveUtils, presentationEmail: email,
emailLoaded: currentEmailLoaded, ))
presentationEmail: expandedPresentationEmail, ..dispatchEmailUIAction(EmailUIAction());
userName: controller.session?.getOwnEmailAddress() ?? '', },
emailActionCallback: (action, email) { bottomBarDecoration: const BoxDecoration(
controller.mailboxDashBoardController color: Colors.white,
..dispatchEmailUIAction(PerformEmailActionInThreadDetailAction( border: Border(
emailActionType: action, top: BorderSide(color: AppColor.colorDividerEmailView),
presentationEmail: email,
))
..dispatchEmailUIAction(EmailUIAction());
},
bottomBarDecoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: AppColor.colorDividerEmailView),
),
),
padding: EdgeInsets.zero,
), ),
), ),
padding: EdgeInsets.zero,
); );
}), }),
if (controller.responsiveUtils.isDesktop(context))
const SizedBox(height: 16),
], ],
); );
@@ -204,17 +192,19 @@ class ThreadDetailView extends GetWidget<ThreadDetailController> {
bodyWidget = SelectionArea(child: bodyWidget); bodyWidget = SelectionArea(child: bodyWidget);
} }
return ClipRRect(
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(20)),
child: bodyWidget,
);
}
EdgeInsetsGeometry _padding(BuildContext context) {
if (controller.responsiveUtils.isDesktop(context)) { if (controller.responsiveUtils.isDesktop(context)) {
return const EdgeInsetsDirectional.only(end: 16); return Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Colors.white,
),
margin: const EdgeInsetsDirectional.only(end: 16, bottom: 16),
clipBehavior: Clip.antiAlias,
child: bodyWidget,
);
} else {
return ColoredBox(color: Colors.white, child: bodyWidget);
} }
return EdgeInsets.zero;
} }
PresentationMailbox? _getMailboxContain() { PresentationMailbox? _getMailboxContain() {
@@ -71,9 +71,6 @@ class ThreadDetailAppBar extends StatelessWidget {
padding: PlatformInfo.isIOS padding: PlatformInfo.isIOS
? EmailViewAppBarWidgetStyles.paddingIOS(context, responsiveUtils) ? EmailViewAppBarWidgetStyles.paddingIOS(context, responsiveUtils)
: EmailViewAppBarWidgetStyles.padding, : EmailViewAppBarWidgetStyles.padding,
margin: !PlatformInfo.isMobile && responsiveUtils.isDesktop(context)
? const EdgeInsetsDirectional.only(end: 16)
: EdgeInsets.zero,
decoration: const BoxDecoration( decoration: const BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
@@ -81,9 +78,6 @@ class ThreadDetailAppBar extends StatelessWidget {
width: EmailViewAppBarWidgetStyles.bottomBorderWidth, width: EmailViewAppBarWidgetStyles.bottomBorderWidth,
), ),
), ),
borderRadius: BorderRadius.vertical(
top: Radius.circular(EmailViewAppBarWidgetStyles.radius),
),
color: EmailViewAppBarWidgetStyles.backgroundColor, color: EmailViewAppBarWidgetStyles.backgroundColor,
), ),
child: Row( child: Row(