TF-984 Apply new design for toast message when move action

This commit is contained in:
dab246
2022-10-10 23:39:40 +07:00
committed by Dat H. Pham
parent 3796e60401
commit 0e9ba0de8a
10 changed files with 208 additions and 54 deletions
@@ -60,7 +60,7 @@ extension AppColor on Color {
static const disableSendEmailButtonColor = Color(0xFFA9B4C2);
static const borderLeftEmailContentColor = Color(0xFFEFEFEF);
static const toastBackgroundColor = Color(0xFFACAFFF);
static const toastSuccessBackgroundColor = Color(0xFF04AA11);
static const toastSuccessBackgroundColor = Color(0xFF4BB34B);
static const toastErrorBackgroundColor = Color(0xFFFF5858);
static const toastWithActionBackgroundColor = Color(0xFF3F3F3F);
static const buttonActionToastWithActionColor = Color(0xFF7ADCF8);
@@ -161,6 +161,7 @@ class ImagePaths {
String get icCalendar => _getImagePath('ic_calendar.svg');
String get icAddEmailForward => _getImagePath('ic_add_email_forwards.svg');
String get icChevronDownOutline => _getImagePath('ic_chevron_down_outline.svg');
String get icUndo => _getImagePath('ic_undo.svg');
String _getImagePath(String imageName) {
return AssetsPaths.images + imageName;
+76 -18
View File
@@ -38,37 +38,95 @@ class AppToast {
gravity: ToastGravity.BOTTOM);
}
void showToastWithAction(
void showBottomToast(
BuildContext context,
String message,
String actionName,
Function onActionClick, {double? maxWidth}) {
{
String? actionName,
Function? onActionClick,
Widget? actionIcon,
Widget? leadingIcon,
double? maxWidth,
Color? backgroundColor,
Color? textColor,
Color? textActionColor,
}
) {
var trailingAction;
if (actionName != null) {
if (actionIcon == null) {
trailingAction = TextButton(
onPressed: () {
ToastView.dismiss();
onActionClick?.call();
},
child: Text(
actionName,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.normal,
color: textActionColor ?? AppColor.buttonActionToastWithActionColor),
),
);
} else {
trailingAction = Material(
color: Colors.transparent,
child: InkWell(
onTap: () {
ToastView.dismiss();
onActionClick?.call();
},
customBorder: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 6, horizontal: 8),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
actionIcon,
Text(
actionName,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.normal,
color: textActionColor ?? Colors.white),
)
]
),
)),
);
}
}
showToastMessage(
context,
message,
maxWidth: maxWidth,
trailing: TextButton(
onPressed: () {
ToastView.dismiss();
onActionClick.call();
},
child: Text(
actionName,
style: const TextStyle(fontSize: 16, color: AppColor.buttonActionToastWithActionColor),
),
));
backgroundColor: backgroundColor,
textColor: textColor,
leading: leadingIcon,
trailing: trailingAction);
}
void showToastMessage(BuildContext context, String message, {
Widget? leading, Widget? trailing, double? maxWidth
void showToastMessage(
BuildContext context,
String message, {
Color? textColor,
Widget? leading,
Widget? trailing,
double? maxWidth,
Color? backgroundColor
}) {
TMailToast.showToast(
message,
context,
width: maxWidth,
toastPosition: ToastPosition.BOTTOM,
textStyle: TextStyle(fontSize: 16, color: Colors.white),
backgroundColor: AppColor.toastWithActionBackgroundColor,
textStyle: TextStyle(
fontSize: 15,
fontWeight: FontWeight.normal,
color: textColor ?? Colors.white),
backgroundColor: backgroundColor ?? AppColor.toastWithActionBackgroundColor,
trailing: trailing != null
? Padding(
padding: const EdgeInsets.only(left: 8),
@@ -79,7 +137,7 @@ class AppToast {
padding: const EdgeInsets.only(right: 8),
child: PointerInterceptor(child: leading))
: null,
toastBorderRadius: 5.0,
toastBorderRadius: 10.0,
toastDuration: 3
);
}