added wallet functionality
This commit is contained in:
@@ -5,39 +5,74 @@ class StatusChip extends StatelessWidget {
|
||||
|
||||
const StatusChip({super.key, required this.status});
|
||||
|
||||
Color _color() {
|
||||
switch (status.toUpperCase()) {
|
||||
case 'SUCCESS':
|
||||
case 'COMPLETE':
|
||||
return Colors.green;
|
||||
case 'FAILED':
|
||||
return Colors.red;
|
||||
case 'PROCESSING':
|
||||
return Colors.orange;
|
||||
case 'CONFIRMED':
|
||||
return Colors.blue;
|
||||
default:
|
||||
return Colors.grey;
|
||||
}
|
||||
static const _successStatuses = {'SUCCESS', 'COMPLETE', 'COMPLETED'};
|
||||
static const _processingStatuses = {'PROCESSING', 'REQUESTED', 'CONFIRMING'};
|
||||
static const _pendingStatuses = {'CREATED', 'CONFIRMED_ALL'};
|
||||
|
||||
Map<String, dynamic> _getStatusColors() {
|
||||
final upper = status.toUpperCase();
|
||||
final bool isSuccess = _successStatuses.contains(upper);
|
||||
final bool isProcessing = _processingStatuses.contains(upper);
|
||||
final bool isPending = _pendingStatuses.contains(upper);
|
||||
|
||||
final Color bgColor = isSuccess
|
||||
? const Color(0xFFD1FAE5)
|
||||
: isProcessing
|
||||
? const Color(0xFFDBEAFE)
|
||||
: isPending
|
||||
? const Color(0xFFFEF3C7)
|
||||
: const Color(0xFFFEE2E2);
|
||||
|
||||
final Color textColor = isSuccess
|
||||
? const Color(0xFF065F46)
|
||||
: isProcessing
|
||||
? const Color(0xFF1E40AF)
|
||||
: isPending
|
||||
? const Color(0xFF92400E)
|
||||
: const Color(0xFF991B1B);
|
||||
|
||||
final Color dotColor = isSuccess
|
||||
? const Color(0xFF10B981)
|
||||
: isProcessing
|
||||
? const Color(0xFF3B82F6)
|
||||
: isPending
|
||||
? const Color(0xFFF59E0B)
|
||||
: const Color(0xFFEF4444);
|
||||
|
||||
return {'bgColor': bgColor, 'textColor': textColor, 'dotColor': dotColor};
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final color = _color();
|
||||
final colors = _getStatusColors();
|
||||
final bgColor = colors['bgColor'] as Color;
|
||||
final textColor = colors['textColor'] as Color;
|
||||
final dotColor = colors['dotColor'] as Color;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: color.withAlpha(25),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: color.withAlpha(80)),
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(
|
||||
status,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: color,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(color: dotColor, shape: BoxShape.circle),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
status,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user