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