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) {
return ColoredBox(
color: controller.responsiveUtils.isWebDesktop(context)
? AppColor.colorBgDesktop
: Colors.white,
child: SafeArea(
right: controller.responsiveUtils.isLandscapeMobile(context),
left: controller.responsiveUtils.isLandscapeMobile(context),
bottom: !PlatformInfo.isIOS,
child: bodyWidget,
),
return SafeArea(
right: controller.responsiveUtils.isLandscapeMobile(context),
left: controller.responsiveUtils.isLandscapeMobile(context),
bottom: !PlatformInfo.isIOS,
child: bodyWidget,
);
} else {
return bodyWidget;
@@ -235,14 +230,9 @@ class EmailView extends GetWidget<SingleEmailController> {
}
BoxDecoration _getDecorationEmailView(BuildContext context) {
if (controller.responsiveUtils.isWebDesktop(context) && !isInsideThreadDetailView) {
return const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20)),
color: Colors.white,
);
}
if (controller.currentEmail == null || isFirstEmailInThreadDetail) {
if ((controller.responsiveUtils.isWebDesktop(context) && !isInsideThreadDetailView) ||
controller.currentEmail == null ||
isFirstEmailInThreadDetail) {
return const BoxDecoration(color: Colors.white);
}
@@ -73,10 +73,6 @@ class EmailViewAppBarWidget extends StatelessWidget {
width: EmailViewAppBarWidgetStyles.bottomBorderWidth,
)
),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(EmailViewAppBarWidgetStyles.radius),
topRight: Radius.circular(EmailViewAppBarWidgetStyles.radius),
),
color: EmailViewAppBarWidgetStyles.backgroundColor,
),
child: Row(mainAxisAlignment: MainAxisAlignment.end, children: [
@@ -97,17 +97,23 @@ class ThreadDetailView extends GetWidget<ThreadDetailController> {
);
}),
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(
child: Container(
color: Colors.white,
padding: _padding(context),
child: SingleChildScrollView(
controller: controller.scrollController,
child: Column(
mainAxisSize: MainAxisSize.min,
children: controller.getThreadDetailEmailViews()
),
),
child: SingleChildScrollView(
controller: controller.scrollController,
child: threadBody,
),
);
@@ -127,13 +133,7 @@ class ThreadDetailView extends GetWidget<ThreadDetailController> {
if (index != currentIndex) {
return const SizedBox.shrink();
}
return SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: controller.getThreadDetailEmailViews()
),
);
return SingleChildScrollView(child: threadBody);
},
onPageChanged: controller.onThreadPageChanged,
),
@@ -157,42 +157,30 @@ class ThreadDetailView extends GetWidget<ThreadDetailController> {
return const SizedBox.shrink();
}
return Padding(
padding: controller.responsiveUtils.isDesktop(context)
? const EdgeInsetsDirectional.only(end: 16)
: EdgeInsets.zero,
child: ClipRRect(
borderRadius: const BorderRadius.vertical(
bottom: Radius.circular(20),
),
child: EmailViewBottomBarWidget(
key: const Key('email_view_button_bar'),
imagePaths: controller.imagePaths,
responsiveUtils: controller.responsiveUtils,
emailLoaded: currentEmailLoaded,
presentationEmail: expandedPresentationEmail,
userName: controller.session?.getOwnEmailAddress() ?? '',
emailActionCallback: (action, email) {
controller.mailboxDashBoardController
..dispatchEmailUIAction(PerformEmailActionInThreadDetailAction(
emailActionType: action,
presentationEmail: email,
))
..dispatchEmailUIAction(EmailUIAction());
},
bottomBarDecoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: AppColor.colorDividerEmailView),
),
),
padding: EdgeInsets.zero,
return EmailViewBottomBarWidget(
key: const Key('email_view_button_bar'),
imagePaths: controller.imagePaths,
responsiveUtils: controller.responsiveUtils,
emailLoaded: currentEmailLoaded,
presentationEmail: expandedPresentationEmail,
userName: controller.session?.getOwnEmailAddress() ?? '',
emailActionCallback: (action, email) {
controller.mailboxDashBoardController
..dispatchEmailUIAction(PerformEmailActionInThreadDetailAction(
emailActionType: action,
presentationEmail: email,
))
..dispatchEmailUIAction(EmailUIAction());
},
bottomBarDecoration: const BoxDecoration(
color: Colors.white,
border: Border(
top: BorderSide(color: AppColor.colorDividerEmailView),
),
),
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);
}
return ClipRRect(
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(20)),
child: bodyWidget,
);
}
EdgeInsetsGeometry _padding(BuildContext 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() {
@@ -71,9 +71,6 @@ class ThreadDetailAppBar extends StatelessWidget {
padding: PlatformInfo.isIOS
? EmailViewAppBarWidgetStyles.paddingIOS(context, responsiveUtils)
: EmailViewAppBarWidgetStyles.padding,
margin: !PlatformInfo.isMobile && responsiveUtils.isDesktop(context)
? const EdgeInsetsDirectional.only(end: 16)
: EdgeInsets.zero,
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
@@ -81,9 +78,6 @@ class ThreadDetailAppBar extends StatelessWidget {
width: EmailViewAppBarWidgetStyles.bottomBorderWidth,
),
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(EmailViewAppBarWidgetStyles.radius),
),
color: EmailViewAppBarWidgetStyles.backgroundColor,
),
child: Row(