TF-802 Show message when enable/disable vacation responder

This commit is contained in:
dab246
2022-08-18 17:04:55 +07:00
committed by Dat H. Pham
parent 20a2e94b8e
commit 593bf511e6
11 changed files with 166 additions and 29 deletions
@@ -2,6 +2,7 @@
import 'package:core/core.dart';
import 'package:flutter/material.dart';
import 'package:jmap_dart_client/jmap/mail/vacation/vacation_response.dart';
import 'package:tmail_ui_user/features/manage_account/presentation/extensions/vacation_response_extension.dart';
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
typedef DisableVacationResponderAction = Function();
@@ -13,6 +14,9 @@ class VacationNotificationMessageWidget extends StatelessWidget {
final EdgeInsets? margin;
final EdgeInsets? padding;
final double? radius;
final Widget? leadingIcon;
final Color? backgroundColor;
final FontWeight? fontWeight;
const VacationNotificationMessageWidget({
super.key,
@@ -21,6 +25,9 @@ class VacationNotificationMessageWidget extends StatelessWidget {
this.radius,
this.margin,
this.padding,
this.leadingIcon,
this.backgroundColor,
this.fontWeight,
});
@override
@@ -28,31 +35,33 @@ class VacationNotificationMessageWidget extends StatelessWidget {
return Container(
width: double.infinity,
margin: margin ?? const EdgeInsets.symmetric(horizontal: 16),
padding: padding ?? const EdgeInsets.only(top: 5, bottom: 5, left: 16),
padding: padding ?? const EdgeInsets.only(left: 16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(radius ?? 5),
color: AppColor.colorVacationNotificationMessageBackground,
color: backgroundColor ?? AppColor.colorVacationNotificationMessageBackground,
),
child: Row(children: [
if (leadingIcon != null) leadingIcon!,
Expanded(
child: Text(
AppLocalizations.of(context).yourVacationResponderIsEnabled,
style: const TextStyle(
vacationResponse.getNotificationMessage(context),
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: FontWeight.bold,
fontSize: 13,
fontWeight: fontWeight ?? FontWeight.w500,
))),
buildTextButton(
AppLocalizations.of(context).disable.allInCaps,
textStyle: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 16,
color: AppColor.colorTextButton),
backgroundColor: Colors.transparent,
width: 128,
height: 44,
radius: 10,
onTap: () => action?.call())
if (action != null)
buildTextButton(
AppLocalizations.of(context).disable.allInCaps,
textStyle: const TextStyle(
fontWeight: FontWeight.w500,
fontSize: 13,
color: AppColor.colorTextButton),
backgroundColor: Colors.transparent,
width: 128,
height: 44,
radius: 10,
onTap: () => action!.call())
]),
);
}