showSnackBar static method

void showSnackBar({
  1. required BuildContext context,
  2. required dynamic content,
  3. int seconds = 5,
  4. Color? backgroundColor,
  5. double? borderRadius = 5,
  6. double? fontSize = 12,
  7. double? elevation = 5,
  8. double? allPadding = 10,
})

Implementation

static void showSnackBar(
    {required BuildContext context,
    required dynamic content,
    int seconds = 5,
    Color? backgroundColor,
    double? borderRadius = 5,
    double? fontSize = 12,
    double? elevation = 5,
    double? allPadding = 10}) {
  ScaffoldMessenger.maybeOf(context)?.showSnackBar(SnackBar(
    content: Text("$content",
        softWrap: true,
        textAlign: TextAlign.center,
        style: TextStyle(
            fontWeight: FontWeight.w600,
            color: Theme.of(context).primaryColor,
            fontSize: fontSize?.spMin)),
    behavior: SnackBarBehavior.floating,
    padding: fontSize?.spMin.padding,
    elevation: elevation?.spMin,
    key: UniqueKey(),
    clipBehavior: Clip.antiAliasWithSaveLayer,
    duration: Duration(seconds: seconds),
    backgroundColor: backgroundColor ?? Theme.of(context).primaryColorLight,
    shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(borderRadius?.spMin ?? 0)),
  ));
}