toast static method

void toast(
  1. BuildContext context,
  2. String message, {
  3. Duration? duration,
  4. TextStyle? textStyle,
})

Implementation

static void toast(BuildContext context, String message, {Duration? duration, TextStyle? textStyle}) async{
  final content = Container(
    margin: EdgeInsets.all(10),
    padding: EdgeInsets.only(left: 20, right: 20, top: 15, bottom: 15),
    width: double.infinity,
    decoration: NUIBoxDecoration(
        color: NUIColors.NUIBlack.withOpacity(0.2),
        shadowRadius: 3,
        borderRadiusCircular: 15
    ),
    child: Text(
      message,
      style: textStyle ?? TextStyle(fontSize: 14, color: NUIColors.NUIWhite),
    ),
  );

  if(context == null) triggerNUISnack(NUISnackItem(content: content, duration: duration ?? Duration(seconds: 3), backgroundColor: NUIColors.NUITransparent, elevation: 0));
  else {
    snack(context: context,
        content: content,
        elevation: 0.0,
        backgroundColor: NUIColors.NUITransparent,
        duration: duration ?? Duration(seconds: 3));
  }
}