Loading dialog

void signInwithGoogle() {
    showLoadingDialog(context);
    AuthService().signInwithGoogle();
    Navigator.of(context).pop();
  }



 import 'dart:ui';

import 'package:flutter/material.dart';
import '../../utils/colors.dart';
import 'custom_text.dart';

showLoadingDialog(BuildContext context) {
  return showGeneralDialog(
    barrierDismissible: false,
    barrierLabel: '',
    barrierColor: Colors.black38,
    transitionDuration: const Duration(milliseconds: 300),
    pageBuilder: (ctx, anim1, anim2) => AlertDialog(
      shape: const RoundedRectangleBorder(
          borderRadius: BorderRadius.all(Radius.circular(20.0))),
      title: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: const [
          CircularProgressIndicator(
            color: blackColor,
          ),
          SizedBox(width: 20),
          Text("Loading...", style: TextStyle(color: blackColor)),
        ],
      ),
      content: Row(
        mainAxisAlignment: MainAxisAlignment.end,
        children: const [
          Icon(
            Icons.hourglass_empty,
            color: blackColor,
            size: 20,
          ),
          CustomText(
            size: 12,
            text: "  Processing",
            fontWeight: FontWeight.w500,
            textColor: blackColor,
          )
        ],
      ),
      elevation: 2,
    ),
    transitionBuilder: (ctx, anim1, anim2, child) => BackdropFilter(
      filter:
          ImageFilter.blur(sigmaX: 4 * anim1.value, sigmaY: 4 * anim1.value),
      child: FadeTransition(
        opacity: anim1,
        child: child,
      ),
    ),
    context: context,
  );
}

Comments