displaySuccess static method

dynamic displaySuccess({
  1. required BuildContext context,
  2. required String message,
  3. int? duration,
})

Implementation

static displaySuccess({
  required BuildContext context,
  required String message,
  int? duration,
}) {
  final snackBar = SnackBar(
    content: Text(message),
    backgroundColor: Colors.green,
    duration: Duration(seconds: duration ?? 10),
    action: SnackBarAction(
      label: 'Close',
      textColor: Colors.white,
      onPressed: () {},
    ),
  );

  // Find the Scaffold in the widget tree and use it to show a SnackBar.
  ScaffoldMessenger.of(context).showSnackBar(snackBar);
}