195 lines
6.1 KiB
Dart
195 lines
6.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
class KonfirmasiUangModal extends StatelessWidget {
|
|
final int nominal;
|
|
final VoidCallback onKonfirmasi;
|
|
final VoidCallback onBatal;
|
|
|
|
const KonfirmasiUangModal({
|
|
super.key,
|
|
required this.nominal,
|
|
required this.onKonfirmasi,
|
|
required this.onBatal,
|
|
});
|
|
|
|
static Future<void> show(
|
|
BuildContext context, {
|
|
required int nominal,
|
|
required VoidCallback onKonfirmasi,
|
|
required VoidCallback onBatal,
|
|
}) {
|
|
return showDialog(
|
|
context: context,
|
|
barrierDismissible: false,
|
|
useRootNavigator: true,
|
|
barrierColor: Colors.black.withOpacity(0.5),
|
|
builder: (_) => KonfirmasiUangModal(
|
|
nominal: nominal,
|
|
onKonfirmasi: onKonfirmasi,
|
|
onBatal: onBatal,
|
|
),
|
|
);
|
|
}
|
|
|
|
String get _nominalFormatted => NumberFormat.currency(
|
|
locale: 'id_ID',
|
|
symbol: 'Rp ',
|
|
decimalDigits: 0,
|
|
).format(nominal);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Dialog(
|
|
backgroundColor: Colors.transparent,
|
|
insetPadding: const EdgeInsets.symmetric(horizontal: 24),
|
|
child: Container(
|
|
padding: const EdgeInsets.fromLTRB(24, 28, 24, 28),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(24),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
width: 72,
|
|
height: 72,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFE8F4FD),
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: const Center(
|
|
child: Text('💵', style: TextStyle(fontSize: 38)),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
|
|
const Text(
|
|
'Konfirmasi Uang Masuk',
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.black87,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
|
|
Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFFF0F9FF),
|
|
borderRadius: BorderRadius.circular(14),
|
|
border: Border.all(
|
|
color: const Color(0xFF5B9BD5).withOpacity(0.3),
|
|
),
|
|
),
|
|
child: Text(
|
|
_nominalFormatted,
|
|
textAlign: TextAlign.center,
|
|
style: const TextStyle(
|
|
fontSize: 28,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color(0xFF5B9BD5),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
|
|
Container(
|
|
width: double.infinity,
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
|
decoration: BoxDecoration(
|
|
color: Colors.green.shade50,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(
|
|
Icons.check_circle_outline,
|
|
size: 14,
|
|
color: Colors.green.shade600,
|
|
),
|
|
const SizedBox(width: 6),
|
|
Text(
|
|
'Nominal sudah benar?',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors.green.shade700,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: GestureDetector(
|
|
onTap: onBatal,
|
|
child: Container(
|
|
height: 50,
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey.shade100,
|
|
borderRadius: BorderRadius.circular(14),
|
|
border: Border.all(color: Colors.grey.shade300),
|
|
),
|
|
child: const Center(
|
|
child: Text(
|
|
'Batalkan',
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.black54,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: GestureDetector(
|
|
onTap: onKonfirmasi,
|
|
child: Container(
|
|
height: 50,
|
|
decoration: BoxDecoration(
|
|
color: const Color(0xFF5B9BD5),
|
|
borderRadius: BorderRadius.circular(14),
|
|
),
|
|
child: const Center(
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(
|
|
Icons.check_circle_outline,
|
|
color: Colors.white,
|
|
size: 18,
|
|
),
|
|
SizedBox(width: 6),
|
|
Text(
|
|
'Ya, Masukkan',
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|