show method

dynamic show({
  1. required String content,
  2. SnackType snackType = SnackType.info,
  3. SnackBarBehavior behavior = SnackBarBehavior.fixed,
})

show the snack bar content is responsible for the text of the snack bar

Implementation

show({
  required String content,
  SnackType snackType = SnackType.info,
  SnackBarBehavior behavior = SnackBarBehavior.fixed,
}) async {
  await Flushbar(
    message: content,
    icon: _getSnackbarIcon(snackType),
    borderColor: _getSnackbarColor(snackType),
    borderRadius: BorderRadius.circular(4.0),
    duration: const Duration(seconds: 5),
    margin: const EdgeInsets.symmetric(horizontal: 20),
    flushbarPosition: FlushbarPosition.TOP,
    messageColor: _getSnackbarColor(snackType),
    backgroundColor: _getSnackbarBgColor(snackType),

    // leftBarIndicatorColor: Colors.blue[300],
    mainButton: TextButton(
      onPressed: () {
        Navigator.pop(context);
        // if (Get.isSnackbarOpen) {
        //   Get.closeCurrentSnackbar();
        // }
      },
      style: TextButton.styleFrom(
        minimumSize: Size.zero,
        padding: EdgeInsets.zero,
      ),
      child: Text(
        '✕',
        style: satoshiMedium16.copyWith(color: _getSnackbarColor(snackType)),
      ),
    ),
  ).show(context);
}