light static method

void light({
  1. required BuildContext context,
  2. required String text,
  3. required Color color,
  4. required Color textColor,
  5. double width = 300,
  6. Duration duration = const Duration(milliseconds: 1200),
})

A floating toast with a semi-transparent (light) background.

  • text The message to display.
  • color Border and tinted background color.
  • textColor Color of the message text.
  • width Width of the snackbar. Defaults to 300.
  • duration How long the toast is visible. Defaults to 1200 ms.

Implementation

static void light({
  required BuildContext context,
  required String text,
  required Color color,
  required Color textColor,
  double width = 300,
  Duration duration = const Duration(milliseconds: 1200),
}) {
  _show(
    context,
    SnackBar(
      clipBehavior: Clip.antiAliasWithSaveLayer,
      elevation: 0,
      shape: OutlineInputBorder(borderSide: BorderSide(color: color)),
      width: width,
      behavior: SnackBarBehavior.floating,
      duration: duration,
      backgroundColor: color.withAlpha(36),
      content: Text(text, style: TextStyle(color: textColor)),
    ),
  );
}