70 lines
2.6 KiB
Dart
70 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:quiz_app/app/const/colors/app_colors.dart';
|
|
|
|
class DeleteQuestionDialog {
|
|
static Future<void> show({
|
|
required BuildContext context,
|
|
required VoidCallback onDelete,
|
|
}) async {
|
|
showDialog(
|
|
context: context,
|
|
barrierDismissible: true,
|
|
builder: (context) {
|
|
return Dialog(
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Text(
|
|
"Hapus Soal?",
|
|
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: AppColors.darkText),
|
|
),
|
|
const SizedBox(height: 16),
|
|
const Text(
|
|
"Soal ini akan dihapus dari daftar kuis. Yakin ingin menghapus?",
|
|
style: TextStyle(fontSize: 14, color: AppColors.softGrayText),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
const SizedBox(height: 24),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ElevatedButton(
|
|
onPressed: () => Navigator.pop(context),
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.white,
|
|
foregroundColor: AppColors.primaryBlue,
|
|
side: const BorderSide(color: AppColors.primaryBlue),
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
),
|
|
child: const Text("Batal"),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: ElevatedButton(
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
onDelete();
|
|
},
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: AppColors.primaryBlue,
|
|
foregroundColor: Colors.white,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
),
|
|
child: const Text("Hapus"),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|