TF-2827 Only enable reply/forward button when email content loaded
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:get/get.dart';
|
||||
import 'package:model/email/email_action_type.dart';
|
||||
import 'package:model/email/presentation_email.dart';
|
||||
import 'package:model/extensions/presentation_email_extension.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/controller/single_email_controller.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/styles/email_view_bottom_bar_widget_styles.dart';
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
|
||||
@@ -15,6 +16,7 @@ class EmailViewBottomBarWidget extends StatelessWidget {
|
||||
|
||||
final _imagePaths = Get.find<ImagePaths>();
|
||||
final _responsiveUtils = Get.find<ResponsiveUtils>();
|
||||
final _singleEmailController = Get.find<SingleEmailController>();
|
||||
|
||||
final PresentationEmail presentationEmail;
|
||||
final OnEmailActionCallback emailActionCallback;
|
||||
@@ -45,55 +47,73 @@ class EmailViewBottomBarWidget extends StatelessWidget {
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
children: [
|
||||
if (presentationEmail.numberOfAllEmailAddress() > 1)
|
||||
Expanded(
|
||||
child: TMailButtonWidget(
|
||||
key: const Key('reply_all_emails_button'),
|
||||
text: AppLocalizations.of(context).reply_all,
|
||||
icon: _imagePaths.icReplyAll,
|
||||
borderRadius: EmailViewBottomBarWidgetStyles.buttonRadius,
|
||||
iconSize: EmailViewBottomBarWidgetStyles.buttonIconSize,
|
||||
textAlign: TextAlign.center,
|
||||
flexibleText: true,
|
||||
padding: EmailViewBottomBarWidgetStyles.buttonPadding,
|
||||
backgroundColor: EmailViewBottomBarWidgetStyles.buttonBackgroundColor,
|
||||
textStyle: EmailViewBottomBarWidgetStyles.getButtonTextStyle(context, _responsiveUtils),
|
||||
verticalDirection: _responsiveUtils.isPortraitMobile(context),
|
||||
onTapActionCallback: () => emailActionCallback.call(EmailActionType.replyAll, presentationEmail),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TMailButtonWidget(
|
||||
key: const Key('reply_email_button'),
|
||||
text: AppLocalizations.of(context).reply,
|
||||
icon: _imagePaths.icReply,
|
||||
borderRadius: EmailViewBottomBarWidgetStyles.buttonRadius,
|
||||
iconSize: EmailViewBottomBarWidgetStyles.buttonIconSize,
|
||||
textAlign: TextAlign.center,
|
||||
flexibleText: true,
|
||||
padding: EmailViewBottomBarWidgetStyles.buttonPadding,
|
||||
backgroundColor: EmailViewBottomBarWidgetStyles.buttonBackgroundColor,
|
||||
textStyle: EmailViewBottomBarWidgetStyles.getButtonTextStyle(context, _responsiveUtils),
|
||||
verticalDirection: _responsiveUtils.isPortraitMobile(context),
|
||||
onTapActionCallback: () => emailActionCallback.call(EmailActionType.reply, presentationEmail),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TMailButtonWidget(
|
||||
key: const Key('forward_email_button'),
|
||||
text: AppLocalizations.of(context).forward,
|
||||
icon: _imagePaths.icForward,
|
||||
borderRadius: EmailViewBottomBarWidgetStyles.buttonRadius,
|
||||
iconSize: EmailViewBottomBarWidgetStyles.buttonIconSize,
|
||||
textAlign: TextAlign.center,
|
||||
flexibleText: true,
|
||||
padding: EmailViewBottomBarWidgetStyles.buttonPadding,
|
||||
backgroundColor: EmailViewBottomBarWidgetStyles.buttonBackgroundColor,
|
||||
textStyle: EmailViewBottomBarWidgetStyles.getButtonTextStyle(context, _responsiveUtils),
|
||||
verticalDirection: _responsiveUtils.isPortraitMobile(context),
|
||||
onTapActionCallback: () => emailActionCallback.call(EmailActionType.forward, presentationEmail),
|
||||
),
|
||||
),
|
||||
Obx(() {
|
||||
if (_singleEmailController.currentEmailLoaded.value != null
|
||||
&& presentationEmail.numberOfAllEmailAddress() > 1) {
|
||||
return Expanded(
|
||||
child: TMailButtonWidget(
|
||||
key: const Key('reply_all_emails_button'),
|
||||
text: AppLocalizations.of(context).reply_all,
|
||||
icon: _imagePaths.icReplyAll,
|
||||
borderRadius: EmailViewBottomBarWidgetStyles.buttonRadius,
|
||||
iconSize: EmailViewBottomBarWidgetStyles.buttonIconSize,
|
||||
textAlign: TextAlign.center,
|
||||
flexibleText: true,
|
||||
padding: EmailViewBottomBarWidgetStyles.buttonPadding,
|
||||
backgroundColor: EmailViewBottomBarWidgetStyles.buttonBackgroundColor,
|
||||
textStyle: EmailViewBottomBarWidgetStyles.getButtonTextStyle(context, _responsiveUtils),
|
||||
verticalDirection: _responsiveUtils.isPortraitMobile(context),
|
||||
onTapActionCallback: () => emailActionCallback.call(EmailActionType.replyAll, presentationEmail),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Obx(() {
|
||||
if (_singleEmailController.currentEmailLoaded.value != null) {
|
||||
return Expanded(
|
||||
child: TMailButtonWidget(
|
||||
key: const Key('reply_email_button'),
|
||||
text: AppLocalizations.of(context).reply,
|
||||
icon: _imagePaths.icReply,
|
||||
borderRadius: EmailViewBottomBarWidgetStyles.buttonRadius,
|
||||
iconSize: EmailViewBottomBarWidgetStyles.buttonIconSize,
|
||||
textAlign: TextAlign.center,
|
||||
flexibleText: true,
|
||||
padding: EmailViewBottomBarWidgetStyles.buttonPadding,
|
||||
backgroundColor: EmailViewBottomBarWidgetStyles.buttonBackgroundColor,
|
||||
textStyle: EmailViewBottomBarWidgetStyles.getButtonTextStyle(context, _responsiveUtils),
|
||||
verticalDirection: _responsiveUtils.isPortraitMobile(context),
|
||||
onTapActionCallback: () => emailActionCallback.call(EmailActionType.reply, presentationEmail),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Obx(() {
|
||||
if (_singleEmailController.currentEmailLoaded.value != null) {
|
||||
return Expanded(
|
||||
child: TMailButtonWidget(
|
||||
key: const Key('forward_email_button'),
|
||||
text: AppLocalizations.of(context).forward,
|
||||
icon: _imagePaths.icForward,
|
||||
borderRadius: EmailViewBottomBarWidgetStyles.buttonRadius,
|
||||
iconSize: EmailViewBottomBarWidgetStyles.buttonIconSize,
|
||||
textAlign: TextAlign.center,
|
||||
flexibleText: true,
|
||||
padding: EmailViewBottomBarWidgetStyles.buttonPadding,
|
||||
backgroundColor: EmailViewBottomBarWidgetStyles.buttonBackgroundColor,
|
||||
textStyle: EmailViewBottomBarWidgetStyles.getButtonTextStyle(context, _responsiveUtils),
|
||||
verticalDirection: _responsiveUtils.isPortraitMobile(context),
|
||||
onTapActionCallback: () => emailActionCallback.call(EmailActionType.forward, presentationEmail),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}),
|
||||
Expanded(
|
||||
child: TMailButtonWidget(
|
||||
key: const Key('compose_new_email_button'),
|
||||
|
||||
Reference in New Issue
Block a user