showVerificationDialog function
void
showVerificationDialog(
- BuildContext context, {
- required bool isSuccess,
- required String message,
- required VoidCallback onButtonPressed,
Implementation
void showVerificationDialog(
BuildContext context, {
required bool isSuccess,
required String message,
required VoidCallback onButtonPressed,
}) {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return PopScope(
canPop: false,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 25, sigmaY: 25),
child: Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 0,
backgroundColor: Colors.transparent,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: getAdaptiveTextSize(context, 15),
vertical: getAdaptiveTextSize(context, 40),
),
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.black26,
blurRadius: 10.0,
offset: const Offset(0.0, 10.0),
),
],
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
//height: getAdaptiveTextSize(context, 100),
//width: getAdaptiveTextSize(context, 100),
decoration: BoxDecoration(
color: isSuccess
? Colors.green.withOpacity(0.1)
: Colors.red.withOpacity(0.1),
shape: BoxShape.circle,
),
child: Center(
child: Icon(
isSuccess ? Icons.check_circle : Icons.error,
color: isSuccess ? Colors.green : Colors.red,
size: getAdaptiveTextSize(context, 50),
),
),
),
SizedBox(height: getAdaptiveTextSize(context, 20)),
Text(
isSuccess ? 'Verification Successful' : 'Verification Failed',
style: TextStyle(
fontSize: getAdaptiveTextSize(context, 20),
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
SizedBox(height: getAdaptiveTextSize(context, 15)),
Text(
message,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: getAdaptiveTextSize(context, 16),
color: Colors.black54,
),
),
SizedBox(height: getAdaptiveTextSize(context, 25)),
ElevatedButton(
onPressed: () {
onButtonPressed();
},
style: ElevatedButton.styleFrom(
backgroundColor: isSuccess ? Colors.green : Colors.red,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
padding: EdgeInsets.symmetric(
horizontal: getAdaptiveTextSize(context, 30),
vertical: getAdaptiveTextSize(context, 12),
),
elevation: 0,
),
child: Text(
isSuccess ? 'Finish' : 'Try Again',
style: TextStyle(
fontSize: getAdaptiveTextSize(context, 16),
color: Colors.white,
fontWeight: FontWeight.w600,
),
),
),
],
),
),
),
),
);
},
);
}