showLoadingMessage function

void showLoadingMessage({
  1. required BuildContext context,
  2. String title = 'Loading...',
  3. String content = 'Please wait. Your route is being calculated.',
})

Implementation

void showLoadingMessage(
    {required BuildContext context,
    String title = 'Loading...',
    String content = 'Please wait. Your route is being calculated.'}) {
  Platform.isAndroid
      ? showDialog(
          context: context,
          builder: (context) => AlertDialog(
            title: Text(
              title,
              maxLines: 2,
              overflow: TextOverflow.ellipsis,
            ),
            content: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Flexible(
                  child: Text(
                    content,
                    maxLines: 3,
                    overflow: TextOverflow.ellipsis,
                  ),
                ),
                const CircularProgressIndicator()
              ],
            ),
          ),
        )
      : showCupertinoDialog(
          context: context,
          builder: (context) => CupertinoAlertDialog(
            title: Text(
              title,
              maxLines: 2,
              overflow: TextOverflow.ellipsis,
            ),
            content: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Flexible(
                  child: Text(
                    content,
                    maxLines: 3,
                    overflow: TextOverflow.ellipsis,
                  ),
                ),
                const CupertinoActivityIndicator()
              ],
            ),
          ),
        );
  return;
}