proxibuy_bussiness/lib/presentation/widgets/delete_confirmation_dialog....

104 lines
3.7 KiB
Dart

import 'package:business_panel/core/config/app_colors.dart';
import 'package:business_panel/gen/assets.gen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
Future<void> showDeleteConfirmationDialog(
BuildContext context, {
required String title,
required String content,
required VoidCallback onConfirm,
}) async {
await showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
elevation: 10,
backgroundColor: Colors.white,
child: Stack(
clipBehavior: Clip.none,
alignment: Alignment.topCenter,
children: [
Padding(
padding: const EdgeInsets.only(top: 50, left: 20, right: 20, bottom: 20),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
title,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 16),
Text(
content,
style: const TextStyle(color: AppColors.hint, fontSize: 16, height: 1.6),
textAlign: TextAlign.start,
),
const SizedBox(height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text(
"لغو",
style: TextStyle(color: Colors.black),
),
),
ElevatedButton(
style: ElevatedButton.styleFrom(
side: BorderSide(color: AppColors.expiryReserve),
backgroundColor: AppColors.backDelete,
foregroundColor: AppColors.expiryReserve,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
padding: const EdgeInsets.symmetric(
horizontal: 40, vertical: 10),
),
onPressed: () {
onConfirm();
Navigator.of(context).pop();
},
child: const Text("حذف تخفیف"),
),
],
),
],
),
),
Positioned(
top: -40,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
blurRadius: 8,
offset: const Offset(0, 4),
),
],
),
child: CircleAvatar(
backgroundColor: Colors.white,
radius: 40,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: SvgPicture.asset(
Assets.icons.trash2,
height: 50,
width: 50,
),
),
),
),
),
],
),
);
},
);
}