showConnectionSnackBar method

dynamic showConnectionSnackBar({
  1. required BuildContext context,
  2. required String msg,
  3. bool status = false,
})

Implementation

showConnectionSnackBar({required BuildContext context,required String msg,bool status=false})async {
  if (defaultTargetPlatform == TargetPlatform.iOS) {
    Fluttertoast.showToast(
        msg: msg,
        toastLength: Toast.LENGTH_SHORT,
        gravity: ToastGravity.CENTER,
        timeInSecForIosWeb: 1,
        backgroundColor: CssColors.popupTextColor,
        textColor: Colors.white,
        fontSize: 12.0
    );
  }
  else{
    ScaffoldMessenger.of(context).hideCurrentSnackBar();
    ScaffoldMessenger.of(context).showSnackBar(
        SnackBar(
          backgroundColor: status ? CssColors.appColor : CssColors.errorHighlightColor,
          content: Text(msg),
        )
    );
  }
}