showSimpleSnackBar method

ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showSimpleSnackBar(
  1. String message, {
  2. double? fontSize,
  3. Color? fontColor,
  4. TextStyle? textStyle,
  5. Color? backgroundColor,
  6. Duration? duration,
})

Display simple snackbar

if textStyle is given then fontColor and fontSize will be ignored

Default Duration = 3 Seconds

Implementation

ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showSimpleSnackBar(
    String message,
    {double? fontSize,
    Color? fontColor,
    TextStyle? textStyle,
    Color? backgroundColor,
    Duration? duration}) {
  return ScaffoldMessenger.of(this).showSnackBar(
    SnackBar(
      content: Text(
        message,
        style: textStyle ??= TextStyle(fontSize: fontSize, color: fontColor),
      ),
      backgroundColor: backgroundColor,
      duration: duration ??= 3.seconds,
    ),
  );
}