showSKProgressDialog function

dynamic showSKProgressDialog({
  1. BuildContext? context,
  2. RoundedRectangleBorder? shape,
  3. String? textToBeDisplayed,
  4. Color barrierColor = Colors.black12,
  5. BuildContextPredicate buildContextPredicate = _defaultContextPredicate,
})

Implementation

showSKProgressDialog({
  BuildContext? context,
  RoundedRectangleBorder? shape,
  String? textToBeDisplayed,
  Color barrierColor = Colors.black12,
  BuildContextPredicate buildContextPredicate = _defaultContextPredicate,
}) {
  if (context == null) {
    _throwIfNoContext(_contextMap.values, 'showAlert');
  }
  context ??= buildContextPredicate(_contextMap.values);

  if (isProgressDismissed) {
    isProgressDismissed = false;
    showGeneralDialog<bool>(
      context: context,
      barrierColor: barrierColor,
      pageBuilder: (context, animation, secondaryAnimation) {
        return CustomProgressDialog(
          child: Container(
            clipBehavior: Clip.hardEdge,
            decoration: BoxDecoration(
                color: Theme.of(context).primaryColor.withAlpha(20),
                borderRadius: const BorderRadius.all(Radius.circular(10))),
            padding: const EdgeInsets.all(15),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                const CupertinoActivityIndicator(
                  radius: 15,
                ),
                textToBeDisplayed == null
                    ? const Padding(
                        padding: EdgeInsets.all(0),
                      )
                    : Padding(
                        padding: const EdgeInsets.only(top: 10),
                        child: Text(
                          textToBeDisplayed,
                          style: const TextStyle(color: Colors.white),
                          textAlign: TextAlign.center,
                        ))
              ],
            ),
          ),
        );
      },
      barrierDismissible: false,
      transitionDuration: const Duration(milliseconds: 100),
    ).then(
      (dismissed) {
        isProgressDismissed =true;
      },
    );
  }
}