feat: refund page

This commit is contained in:
efrilm
2025-08-04 23:13:52 +07:00
parent 2912a438e3
commit 1b1d01c1e8
14 changed files with 2349 additions and 32 deletions
@@ -0,0 +1,90 @@
import 'package:enaklo_pos/core/components/spaces.dart';
import 'package:flutter/material.dart';
class RefundErrorDialog extends StatelessWidget {
final String message;
const RefundErrorDialog({super.key, required this.message});
@override
Widget build(BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
child: Container(
padding: EdgeInsets.all(32),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
gradient: LinearGradient(
colors: [Colors.red[50]!, Colors.white],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.red.withOpacity(0.3),
blurRadius: 20,
offset: Offset(0, 10),
),
],
),
child: Icon(
Icons.error,
color: Colors.white,
size: 40,
),
),
SpaceHeight(24),
Text(
'Error!',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.red[600],
),
),
SpaceHeight(12),
Text(
message,
style: TextStyle(
color: Colors.grey[600],
fontSize: 16,
),
textAlign: TextAlign.center,
),
SpaceHeight(32),
Container(
width: double.infinity,
child: ElevatedButton(
onPressed: () => Navigator.pop(context),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red[600],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
padding: EdgeInsets.symmetric(vertical: 16),
),
child: Text(
'OK',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
),
);
}
}
@@ -0,0 +1,131 @@
import 'package:enaklo_pos/core/components/spaces.dart';
import 'package:enaklo_pos/core/constants/colors.dart';
import 'package:enaklo_pos/core/extensions/int_ext.dart';
import 'package:flutter/material.dart';
class RefundSuccessDialog extends StatelessWidget {
final int refundAmount;
final String selectedReason;
const RefundSuccessDialog(
{super.key, required this.refundAmount, required this.selectedReason});
@override
Widget build(BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
child: Container(
padding: EdgeInsets.all(32),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
gradient: LinearGradient(
colors: [Colors.green[50]!, Colors.white],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.green,
shape: BoxShape.circle,
boxShadow: [
BoxShadow(
color: Colors.green.withOpacity(0.3),
blurRadius: 20,
offset: Offset(0, 10),
),
],
),
child: Icon(
Icons.check,
color: Colors.white,
size: 40,
),
),
SpaceHeight(24),
Text(
'Refund Berhasil!',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: AppColors.primary,
),
),
SpaceHeight(12),
Text(
'Refund sebesar ${(refundAmount).currencyFormatRpV2} telah diproses.',
style: TextStyle(
color: Colors.grey[600],
fontSize: 16,
),
textAlign: TextAlign.center,
),
SpaceHeight(8),
Text(
'Alasan: $selectedReason',
style: TextStyle(
color: Colors.grey[500],
fontSize: 14,
),
textAlign: TextAlign.center,
),
SpaceHeight(32),
Row(
children: [
Expanded(
child: OutlinedButton(
onPressed: () {
Navigator.pop(context);
},
style: OutlinedButton.styleFrom(
side: BorderSide(color: AppColors.primary),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
padding: EdgeInsets.symmetric(vertical: 16),
),
child: Text(
'Print Receipt',
style: TextStyle(
color: AppColors.primary,
fontWeight: FontWeight.bold,
),
),
),
),
SizedBox(width: 16),
Expanded(
child: ElevatedButton(
onPressed: () {
Navigator.pop(context);
Navigator.pop(context);
},
style: ElevatedButton.styleFrom(
backgroundColor: AppColors.primary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
padding: EdgeInsets.symmetric(vertical: 16),
),
child: Text(
'Selesai',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
],
),
),
);
}
}