toasty function
void
toasty(
- BuildContext context,
- String? text, {
- ToastGravity? gravity,
- dynamic length = Toast.LENGTH_SHORT,
- Color? bgColor,
- Color? textColor,
- bool print = false,
- bool removeQueue = false,
- Duration duration = const Duration(seconds: 2),
- BorderRadius? borderRadius,
- EdgeInsets? padding,
Toast with Context
Implementation
void toasty(
BuildContext context,
String? text, {
ToastGravity? gravity,
length = Toast.LENGTH_SHORT,
Color? bgColor,
Color? textColor,
bool print = false,
bool removeQueue = false,
Duration duration = const Duration(seconds: 2),
BorderRadius? borderRadius,
EdgeInsets? padding,
}) {
FToast().init(context);
if (removeQueue) FToast().removeCustomToast();
FToast().showToast(
child: Container(
child: Text(text.validate(),
style: boldTextStyle(color: textColor ?? defaultToastTextColor)),
decoration: BoxDecoration(
color: bgColor ?? defaultToastBackgroundColor,
boxShadow: defaultBoxShadow(),
borderRadius: borderRadius ?? defaultToastBorderRadiusGlobal,
),
padding: padding ?? EdgeInsets.symmetric(vertical: 16, horizontal: 30),
),
gravity: gravity ?? defaultToastGravityGlobal,
toastDuration: duration,
);
if (print) log(text);
}