TF-248 Change ui toast notification
This commit is contained in:
@@ -59,6 +59,8 @@ class ImagePaths {
|
||||
String get icSpamV2 => _getImagePath('ic_spam_v2.svg');
|
||||
String get icMoveV2 => _getImagePath('ic_move_v2.svg');
|
||||
String get icFlagV2 => _getImagePath('ic_flag_v2.svg');
|
||||
String get icReadToast => _getImagePath('ic_read_toast.svg');
|
||||
String get icUnreadToast => _getImagePath('ic_unread_toast.svg');
|
||||
|
||||
String _getImagePath(String imageName) {
|
||||
return AssetsPaths.images + imageName;
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:fluttertoast/fluttertoast.dart';
|
||||
import 'package:getwidget/components/toast/gf_toast.dart';
|
||||
import 'package:getwidget/getwidget.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class AppToast {
|
||||
final fToast = Get.find<FToast>();
|
||||
|
||||
void showToast(String message) {
|
||||
Fluttertoast.showToast(
|
||||
msg: message,
|
||||
@@ -55,4 +59,38 @@ class AppToast {
|
||||
toastDuration: 3
|
||||
);
|
||||
}
|
||||
|
||||
void showToastWithIcon(BuildContext context,
|
||||
{String? message, String? icon, Color? bgColor, double? radius, EdgeInsets? padding, TextStyle? textStyle}) {
|
||||
final toast = Material(
|
||||
color: bgColor ?? Colors.white,
|
||||
elevation: 10,
|
||||
shadowColor: Colors.black54,
|
||||
borderRadius: BorderRadius.all(Radius.circular(radius ?? 10)),
|
||||
child: Container(
|
||||
padding: padding ?? EdgeInsets.symmetric(horizontal: 12.0, vertical: 14),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(radius ?? 10.0),
|
||||
color: Colors.white,
|
||||
),
|
||||
width: 320,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (icon != null) SvgPicture.asset(icon, width: 24, height: 24, fit: BoxFit.fill),
|
||||
SizedBox(width: 10.0),
|
||||
Expanded(child: Text(
|
||||
message ?? '',
|
||||
style: textStyle ?? TextStyle(fontSize: 15, color: Colors.black))),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
fToast.init(context);
|
||||
fToast.showToast(
|
||||
child: toast,
|
||||
gravity: ToastGravity.BOTTOM,
|
||||
toastDuration: Duration(seconds: 2),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user