lightBackgroundToastMessage function

void lightBackgroundToastMessage({
  1. required String text,
  2. required Color color,
  3. required Color textColour,
  4. required BuildContext context,
})

Displays a toast message with a light background effect.

The message appears with a slightly transparent background.

  • text : The message to display.
  • color : The border and background color.
  • textColour : The color of the text.
  • context : The BuildContext to show the snackbar.

Implementation

void lightBackgroundToastMessage(
    {required String text,
    required Color color,
    required Color textColour,
    required BuildContext context}) {
  ScaffoldMessenger.of(context).showSnackBar(SnackBar(
    clipBehavior: Clip.antiAliasWithSaveLayer,
    elevation: 0,
    shape: OutlineInputBorder(borderSide: BorderSide(color: color)),
    width: 300,
    behavior: SnackBarBehavior.floating,
    duration: const Duration(milliseconds: 1200),
    content: Text(
      text,
      style: TextStyle(color: textColour),
    ),
    backgroundColor: color.withAlpha(36),
  ));
}