showZdsToast method

ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showZdsToast(
  1. ZdsToast toast,
  2. {Duration duration = const Duration(seconds: 4),
  3. EdgeInsets padding = const EdgeInsets.only(bottom: 8)}
)

Shows a ZdsToast.

  • duration sets how many seconds the toast is shown on screen, defaulting to 4.
  • padding defines the space to set around the toast, defaulting to EdgeInsets.only(bottom: 8).
ScaffoldMessenger.of(context).showZdsToast(ZdsToast());

See also:

  • ZdsToast, used to define the toast's contents

Implementation

ScaffoldFeatureController<SnackBar, SnackBarClosedReason> showZdsToast(
  ZdsToast toast, {
  Duration duration = const Duration(seconds: 4),
  EdgeInsets padding = const EdgeInsets.only(bottom: 8),
}) {
  return showSnackBar(
    SnackBar(
      content: toast,
      backgroundColor: Colors.transparent,
      elevation: 0,
      behavior: SnackBarBehavior.fixed,
      padding: padding,
      duration: duration,
    ),
  );
}