import 'package:flutter/material.dart';
import '../utils/colors.dart';
import 'custom_text.dart';
void showDeleteDialog(BuildContext context, Function()? ontap) {
showDialog(
context: context,
builder: (BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
child: Container(
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30.0),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(16.0),
child: const CustomText(
size: 18,
text: 'Delete Confirmation',
textColor: blackColor,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: const CustomText(
size: 16,
text: 'Are you sure you want to delete this item?',
textColor: blackColor,
),
),
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop(); // Close the dialog
},
child: const CustomText(
size: 16,
text: 'Cancel',
textColor: Colors.blue,
),
),
TextButton(
onPressed: ontap,
child: const CustomText(
size: 16,
text: 'Delete',
textColor: Colors.red,
),
),
],
),
],
),
),
);
},
);
}
how to call it
:
showDeleteDialog(
context,
() async {
},
);
Comments
Post a Comment