void showDialogConfirmation() async {
final result = await showDialog(
context: context,
builder: (context) {
return SimpleDialog(
contentPadding: const EdgeInsets.all(20),
children: [
const Icon(Icons.info_outline_rounded,
size: 50, color: Colors.black38),
const Gap(16),
const Text(
'Are you sure you want to delete this product?',
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w400,
fontSize: 16,
),
),
const Gap(20),
Row(
children: [
Expanded(
child: FilledButton(
onPressed: () {
Navigator.pop(context, 'yes');
},
style: ButtonStyle(
backgroundColor: const WidgetStatePropertyAll(Colors.red),
foregroundColor:
const WidgetStatePropertyAll(Colors.white),
shape: WidgetStatePropertyAll(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
child: const Text('Yes, I\'m sure'),
),
),
const Gap(16),
Expanded(
child: OutlinedButton(
onPressed: () {
Navigator.pop(context, 'no');
},
style: ButtonStyle(
foregroundColor:
const WidgetStatePropertyAll(Colors.black54),
shape: WidgetStatePropertyAll(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
child: const Text('No, cancel'),
),
),
],
),
],
);
},
);
print('result: $result');
if (result == null) return;
if (result is! String) return;
if (result == 'no') {
print('cancelling...');
return;
}
if (result == 'yes') {
print('deleting...');
return;
}
}