showSnackBar static method

void showSnackBar(
  1. String mensagem,
  2. Color bgColor,
  3. BuildContext context, {
  4. Duration? duration,
  5. IconData? icon,
  6. double? bottomPadding,
})

Implementation

static void showSnackBar(String mensagem, Color bgColor, BuildContext context,
    {Duration? duration, IconData? icon, double? bottomPadding}) {
  ScaffoldMessenger.of(context).showSnackBar(
    SnackBar(
      padding:
          EdgeInsets.only(bottom: bottomPadding ?? 10, left: 20, right: 20),
      content: Row(
        children: [
          Icon(icon ?? Icons.info, color: Colors.white),
          SizedBox(width: 5),
          Flexible(
              child: Text(
            mensagem,
            overflow: TextOverflow.visible,
            style: TextStyle(color: Colors.white),
          )),
        ],
      ),
      backgroundColor: bgColor,
      duration: duration ?? Duration(seconds: 4),
    ),
  );
}