iconMessage function
void
iconMessage({})
Displays a toast message with an icon.
The message appears as a floating snackbar with an icon at the start.
text: The message to display.icon: The IconData to display in the message.iconColor: The color of the icon.color: The background color.textColour: The color of the text.context: The BuildContext to show the snackbar.
Implementation
void iconMessage(
{required String text,
required IconData icon,
required Color iconColor,
required Color color,
required Color textColour,
required BuildContext context}) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
clipBehavior: Clip.antiAliasWithSaveLayer,
elevation: .5,
shape: const OutlineInputBorder(borderSide: BorderSide.none),
width: 300,
behavior: SnackBarBehavior.floating,
duration: const Duration(milliseconds: 1200),
content: Row(
children: [
Container(
height: 32,
width: 32,
color: color.withAlpha(36),
child: Icon(icon, size: 20, color: iconColor),
),
const SizedBox(width: 12),
Text(
text,
style: TextStyle(color: textColour),
),
],
),
backgroundColor: color,
));
}