TF-4036 In a thread, put the three-dot menu (…) in the left side

This commit is contained in:
dab246
2025-09-23 11:04:44 +07:00
committed by Dat H. Pham
parent 64f4096340
commit 8fe6a6215d
@@ -46,45 +46,7 @@ class ThreadDetailAppBar extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final child = LayoutBuilder( final listShortcutActions = <Widget>[
builder: (context, constraints) {
Widget backButton = EmailViewBackButton(
imagePaths: imagePaths,
onBackAction: () => closeThreadDetailAction(context),
mailboxContain: mailboxContain,
isSearchActivated: isSearchRunning,
maxWidth: constraints.maxWidth,
);
if (responsiveUtils.isMobile(context)) {
backButton = Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: backButton,
),
);
}
return Container(
height: PlatformInfo.isIOS
? EmailViewAppBarWidgetStyles.heightIOS(context, responsiveUtils)
: EmailViewAppBarWidgetStyles.height,
padding: PlatformInfo.isIOS
? EmailViewAppBarWidgetStyles.paddingIOS(context, responsiveUtils)
: EmailViewAppBarWidgetStyles.padding,
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
color: EmailViewAppBarWidgetStyles.bottomBorderColor,
width: EmailViewAppBarWidgetStyles.bottomBorderWidth,
),
),
color: EmailViewAppBarWidgetStyles.backgroundColor,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (_supportDisplayMailboxNameTitle(context)) backButton,
if (isThreadDetailEnabled && threadActionReady) ...[
_ThreadDetailAppBarButton( _ThreadDetailAppBarButton(
icon: threadDetailIsStarred icon: threadDetailIsStarred
? imagePaths.icStar ? imagePaths.icStar
@@ -117,20 +79,71 @@ class ThreadDetailAppBar extends StatelessWidget {
? (_) => onThreadActionClick?.call(EmailActionType.deletePermanently) ? (_) => onThreadActionClick?.call(EmailActionType.deletePermanently)
: (_) => onThreadActionClick?.call(EmailActionType.moveToTrash), : (_) => onThreadActionClick?.call(EmailActionType.moveToTrash),
), ),
],
if (!responsiveUtils.isMobile(context)) const Spacer(),
if (AppUtils.getCurrentDirection(context) == TextDirection.rtl)
...optionWidgets.reversed
else
...optionWidgets,
if (isThreadDetailEnabled && threadActionReady)
_ThreadDetailAppBarButton( _ThreadDetailAppBarButton(
icon: imagePaths.icMoreVertical, icon: imagePaths.icMoreVertical,
tooltipMessage: AppLocalizations.of(context).more, tooltipMessage: AppLocalizations.of(context).more,
responsiveUtils: responsiveUtils, responsiveUtils: responsiveUtils,
onTapActionCallback: onThreadMoreActionClick, onTapActionCallback: onThreadMoreActionClick,
), ),
], ];
final isRTL = AppUtils.getCurrentDirection(context) == TextDirection.rtl;
final isThreadActionAvailable = isThreadDetailEnabled && threadActionReady;
final isMobile = responsiveUtils.isMobile(context);
late List<Widget> childrenWidgets;
final child = LayoutBuilder(
builder: (_, constraints) {
Widget backButton = EmailViewBackButton(
imagePaths: imagePaths,
onBackAction: () => closeThreadDetailAction(context),
mailboxContain: mailboxContain,
isSearchActivated: isSearchRunning,
maxWidth: constraints.maxWidth,
);
if (isMobile) {
backButton = Expanded(
child: Align(
alignment: Alignment.centerLeft,
child: backButton,
),
);
childrenWidgets = [
if (_supportDisplayMailboxNameTitle(context)) backButton,
if (isRTL) ...optionWidgets.reversed else ...optionWidgets,
if (isThreadActionAvailable) ...listShortcutActions,
];
} else {
childrenWidgets = [
if (_supportDisplayMailboxNameTitle(context)) backButton,
if (isThreadActionAvailable) ...listShortcutActions,
const Spacer(),
if (isRTL) ...optionWidgets.reversed else ...optionWidgets,
];
}
return Container(
height: PlatformInfo.isIOS
? EmailViewAppBarWidgetStyles.heightIOS(context, responsiveUtils)
: EmailViewAppBarWidgetStyles.height,
padding: PlatformInfo.isIOS
? EmailViewAppBarWidgetStyles.paddingIOS(context, responsiveUtils)
: EmailViewAppBarWidgetStyles.padding,
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
color: EmailViewAppBarWidgetStyles.bottomBorderColor,
width: EmailViewAppBarWidgetStyles.bottomBorderWidth,
),
),
color: EmailViewAppBarWidgetStyles.backgroundColor,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: childrenWidgets,
), ),
); );
}, },