import 'dart:ui';
import 'package:flutter/material.dart';
import '../../utils/colors.dart';
import 'custom_text.dart';
showLoadingDialog(BuildContext context, String? text) {
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(15.0))),
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
height: 25,
width: 25,
child: CircularProgressIndicator(
color: blackColor,
),
),
const SizedBox(width: 20),
CustomText(
size: 18, text: text ?? "Loading...", textColor: blackColor),
],
),
elevation: 0,
),
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,
);
}
Call it like this
showLoadingDialog(context, "Please wait...");
Navigator.pop(context);
Comments
Post a Comment