simpleToastMessage function
void
simpleToastMessage({
- required String text,
- required Color textColour,
- required Color color,
- required BuildContext context,
Displays a simple toast message using a SnackBar.
The message appears as a floating snackbar with a custom background color and text color.
text: The message to display.textColour: The color of the text.color: The background color of the snackbar.context: The BuildContext to show the snackbar.
Implementation
void simpleToastMessage(
{required String text,
required Color textColour,
required Color color,
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,
),
);
}