TF-2929 Fix vacation banner is truncated in french

This commit is contained in:
dab246
2024-07-17 03:31:07 +07:00
committed by Dat H. Pham
parent adaab2198d
commit 287b6b74b0
5 changed files with 129 additions and 120 deletions
@@ -113,7 +113,7 @@ class EmailView extends GetWidget<SingleEmailController> {
) )
) { ) {
return VacationNotificationMessageWidget( return VacationNotificationMessageWidget(
margin: const EdgeInsets.only(left: 12, right: 12, bottom: 5), margin: const EdgeInsetsDirectional.only(start: 12, end: 12, top: 8),
vacationResponse: vacation!, vacationResponse: vacation!,
actionGotoVacationSetting: controller.mailboxDashBoardController.goToVacationSetting, actionGotoVacationSetting: controller.mailboxDashBoardController.goToVacationSetting,
actionEndNow: controller.mailboxDashBoardController.disableVacationResponder actionEndNow: controller.mailboxDashBoardController.disableVacationResponder
@@ -544,14 +544,10 @@ class MailboxDashBoardView extends BaseMailboxDashBoardView {
return Obx(() { return Obx(() {
if (controller.vacationResponse.value?.vacationResponderIsValid == true) { if (controller.vacationResponse.value?.vacationResponderIsValid == true) {
return VacationNotificationMessageWidget( return VacationNotificationMessageWidget(
margin: EdgeInsets.only( margin: const EdgeInsetsDirectional.only(top: 8, end: 16),
top: 16,
right: AppUtils.isDirectionRTL(context) ? 0 : 16,
left: AppUtils.isDirectionRTL(context) ? 16 : 0,
),
vacationResponse: controller.vacationResponse.value!, vacationResponse: controller.vacationResponse.value!,
actionGotoVacationSetting: () => controller.goToVacationSetting(), actionGotoVacationSetting: controller.goToVacationSetting,
actionEndNow: () => controller.disableVacationResponder()); actionEndNow: controller.disableVacationResponder);
} else { } else {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
@@ -4,7 +4,6 @@ import 'package:core/presentation/utils/responsive_utils.dart';
import 'package:core/presentation/views/image/avatar_builder.dart'; import 'package:core/presentation/views/image/avatar_builder.dart';
import 'package:core/presentation/views/responsive/responsive_widget.dart'; import 'package:core/presentation/views/responsive/responsive_widget.dart';
import 'package:core/presentation/views/text/slogan_builder.dart'; import 'package:core/presentation/views/text/slogan_builder.dart';
import 'package:core/utils/platform_info.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:model/model.dart'; import 'package:model/model.dart';
@@ -78,31 +77,26 @@ class ManageAccountDashBoardView extends GetWidget<ManageAccountDashBoardControl
Obx(() { Obx(() {
if (controller.vacationResponse.value?.vacationResponderIsValid == true) { if (controller.vacationResponse.value?.vacationResponderIsValid == true) {
return VacationNotificationMessageWidget( return VacationNotificationMessageWidget(
margin: const EdgeInsets.only( margin: const EdgeInsetsDirectional.only(top: 16, start: 16, end: 16),
top: 16,
left: PlatformInfo.isWeb ? 24 : 16,
right: PlatformInfo.isWeb ? 24 : 16),
fromAccountDashBoard: true, fromAccountDashBoard: true,
vacationResponse: controller.vacationResponse.value!, vacationResponse: controller.vacationResponse.value!,
actionGotoVacationSetting: !controller.inVacationSettings() actionGotoVacationSetting: !controller.inVacationSettings()
? () => controller.selectAccountMenuItem(AccountMenuItem.vacation) ? () => controller.selectAccountMenuItem(AccountMenuItem.vacation)
: null, : null,
actionEndNow: () => controller.disableVacationResponder()); actionEndNow: controller.disableVacationResponder);
} else if ((controller.vacationResponse.value?.vacationResponderIsWaiting == true } else if ((controller.vacationResponse.value?.vacationResponderIsWaiting == true
|| controller.vacationResponse.value?.vacationResponderIsStopped == true) || controller.vacationResponse.value?.vacationResponderIsStopped == true)
&& controller.accountMenuItemSelected.value == AccountMenuItem.vacation) { && controller.accountMenuItemSelected.value == AccountMenuItem.vacation) {
return VacationNotificationMessageWidget( return VacationNotificationMessageWidget(
margin: const EdgeInsets.only( margin: const EdgeInsetsDirectional.only(top: 16, start: 16, end: 16),
top: 16,
left: PlatformInfo.isWeb ? 24 : 16,
right: PlatformInfo.isWeb ? 24 : 16),
fromAccountDashBoard: true, fromAccountDashBoard: true,
vacationResponse: controller.vacationResponse.value!, vacationResponse: controller.vacationResponse.value!,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
leadingIcon: const Padding( leadingIcon: const Padding(
padding: EdgeInsets.only(right: 16), padding: EdgeInsetsDirectional.only(end: 12),
child: Icon(Icons.timer, size: 20), child: Icon(Icons.timer, size: 20),
)); )
);
} else { } else {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
@@ -2,7 +2,6 @@ import 'package:core/presentation/extensions/color_extension.dart';
import 'package:core/presentation/utils/style_utils.dart'; import 'package:core/presentation/utils/style_utils.dart';
import 'package:core/presentation/views/button/icon_button_web.dart'; import 'package:core/presentation/views/button/icon_button_web.dart';
import 'package:core/utils/direction_utils.dart'; import 'package:core/utils/direction_utils.dart';
import 'package:core/utils/platform_info.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@@ -61,16 +60,14 @@ class SettingsView extends GetWidget<SettingsController> {
top: false, top: false,
bottom: false, bottom: false,
child: VacationNotificationMessageWidget( child: VacationNotificationMessageWidget(
margin: const EdgeInsetsDirectional.only( margin: const EdgeInsetsDirectional.only(start: 12, end: 12, top: 8),
start: PlatformInfo.isWeb ? 24 : 16,
end: PlatformInfo.isWeb ? 24 : 16,
top: 16),
fromAccountDashBoard: true, fromAccountDashBoard: true,
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!, vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
actionGotoVacationSetting: !controller.manageAccountDashboardController.inVacationSettings() actionGotoVacationSetting: !controller.manageAccountDashboardController.inVacationSettings()
? () => controller.manageAccountDashboardController.selectAccountMenuItem(AccountMenuItem.vacation) ? () => controller.manageAccountDashboardController.selectAccountMenuItem(AccountMenuItem.vacation)
: null, : null,
actionEndNow: () => controller.manageAccountDashboardController.disableVacationResponder()), actionEndNow: controller.manageAccountDashboardController.disableVacationResponder
),
); );
} else if ((controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsWaiting == true } else if ((controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsWaiting == true
|| controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsStopped == true) || controller.manageAccountDashboardController.vacationResponse.value?.vacationResponderIsStopped == true)
@@ -79,15 +76,12 @@ class SettingsView extends GetWidget<SettingsController> {
top: false, top: false,
bottom: false, bottom: false,
child: VacationNotificationMessageWidget( child: VacationNotificationMessageWidget(
margin: const EdgeInsetsDirectional.only( margin: const EdgeInsetsDirectional.only(start: 12, end: 12, top: 8),
start: PlatformInfo.isWeb ? 24 : 16,
end: PlatformInfo.isWeb ? 24 : 16,
top: 16),
fromAccountDashBoard: true, fromAccountDashBoard: true,
vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!, vacationResponse: controller.manageAccountDashboardController.vacationResponse.value!,
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16), padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 16),
leadingIcon: const Padding( leadingIcon: const Padding(
padding: EdgeInsetsDirectional.only(end: 16), padding: EdgeInsetsDirectional.only(end: 12),
child: Icon(Icons.timer, size: 20), child: Icon(Icons.timer, size: 20),
) )
), ),
@@ -41,7 +41,7 @@ class VacationNotificationMessageWidget extends StatelessWidget {
return Container( return Container(
width: double.infinity, width: double.infinity,
margin: margin ?? const EdgeInsets.symmetric(horizontal: 12), margin: margin ?? const EdgeInsets.symmetric(horizontal: 12),
padding: padding ?? const EdgeInsetsDirectional.only(start: 12), padding: padding ?? const EdgeInsets.symmetric(horizontal: 12, vertical: 5),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(radius ?? 8), borderRadius: BorderRadius.circular(radius ?? 8),
color: backgroundColor ?? AppColor.colorBackgroundNotificationVacationSetting, color: backgroundColor ?? AppColor.colorBackgroundNotificationVacationSetting,
@@ -66,86 +66,111 @@ class VacationNotificationMessageWidget extends StatelessWidget {
return Row(children: [ return Row(children: [
if (leadingIcon != null) leadingIcon!, if (leadingIcon != null) leadingIcon!,
Expanded( Expanded(
child: Tooltip(
message: vacationResponse.getNotificationMessage(context),
child: Text( child: Text(
vacationResponse.getNotificationMessage(context), vacationResponse.getNotificationMessage(context),
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 16, fontSize: 16,
fontWeight: fontWeight ?? FontWeight.normal, fontWeight: fontWeight ?? FontWeight.normal,
))), ),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
)
),
if (actionEndNow != null) if (actionEndNow != null)
buildTextButton( TMailButtonWidget.fromText(
AppLocalizations.of(context).endNow, text: AppLocalizations.of(context).endNow,
textStyle: const TextStyle( textStyle: const TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 16, fontSize: 16,
color: AppColor.colorTextButton), color: AppColor.colorTextButton),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
width: 90, padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
height: 44, borderRadius: 10,
radius: 10, maxWidth: 180,
onTap: () => actionEndNow!.call()), maxLines: 1,
tooltipMessage: AppLocalizations.of(context).endNow,
onTapActionCallback: actionEndNow),
if (actionGotoVacationSetting != null) if (actionGotoVacationSetting != null)
buildTextButton( TMailButtonWidget.fromText(
AppLocalizations.of(context).vacationSetting, text: AppLocalizations.of(context).vacationSetting,
textStyle: const TextStyle( textStyle: const TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 16, fontSize: 16,
color: AppColor.colorTextButton), color: AppColor.colorTextButton),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
width: 150, borderRadius: 10,
height: 44, maxWidth: 310,
radius: 10, maxLines: 1,
onTap: () => actionGotoVacationSetting!.call()) tooltipMessage: AppLocalizations.of(context).vacationSetting,
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
onTapActionCallback: actionGotoVacationSetting)
]); ]);
} }
Widget _buildBodyForMobile(BuildContext context) { Widget _buildBodyForMobile(BuildContext context) {
return Column(children: [ return Column(
Row(children: [ mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (leadingIcon != null) leadingIcon!, if (leadingIcon != null) leadingIcon!,
Expanded( Tooltip(
child: Padding( message: vacationResponse.getNotificationMessage(context),
padding: const EdgeInsets.only(right: 12, top: 12),
child: Center(
child: Text( child: Text(
vacationResponse.getNotificationMessage(context), vacationResponse.getNotificationMessage(context),
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 16, fontSize: 16,
fontWeight: fontWeight ?? FontWeight.normal, fontWeight: fontWeight ?? FontWeight.normal,
)),
), ),
)), maxLines: 1,
]), textAlign: TextAlign.center,
Row(children: [ overflow: TextOverflow.ellipsis,
const Spacer(), ),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (actionEndNow != null) if (actionEndNow != null)
buildTextButton( Flexible(
AppLocalizations.of(context).endNow, child: TMailButtonWidget.fromText(
text: AppLocalizations.of(context).endNow,
textStyle: const TextStyle( textStyle: const TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 16, fontSize: 16,
color: AppColor.colorTextButton), color: AppColor.colorTextButton),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
width: 90, borderRadius: 10,
height: 36, padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
radius: 10, maxWidth: 180,
onTap: () => actionEndNow!.call()), maxLines: 1,
tooltipMessage: AppLocalizations.of(context).endNow,
onTapActionCallback: actionEndNow
),
),
if (actionGotoVacationSetting != null) if (actionGotoVacationSetting != null)
buildTextButton( Flexible(
AppLocalizations.of(context).vacationSetting, child: TMailButtonWidget.fromText(
text: AppLocalizations.of(context).vacationSetting,
textStyle: const TextStyle( textStyle: const TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 16, fontSize: 16,
color: AppColor.colorTextButton), color: AppColor.colorTextButton),
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
width: 150, borderRadius: 10,
height: 36, padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
radius: 10, maxWidth: 180,
onTap: () => actionGotoVacationSetting!.call()), maxLines: 1,
const Spacer(), tooltipMessage: AppLocalizations.of(context).vacationSetting,
]) onTapActionCallback: actionGotoVacationSetting
]); ),
),
]
)
]
);
} }
} }