56 lines
1.3 KiB
Dart
56 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../theme/app_theme.dart';
|
|
|
|
class StatusBadge extends StatelessWidget {
|
|
final String status;
|
|
final double? fontSize;
|
|
|
|
const StatusBadge({
|
|
super.key,
|
|
required this.status,
|
|
this.fontSize,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
|
decoration: BoxDecoration(
|
|
color: AppTheme.getStatusColor(status).withOpacity(0.2),
|
|
borderRadius: BorderRadius.circular(16),
|
|
border: Border.all(
|
|
color: AppTheme.getStatusColor(status),
|
|
width: 1.5,
|
|
),
|
|
),
|
|
child: Text(
|
|
_formatStatus(status),
|
|
style: TextStyle(
|
|
color: AppTheme.getStatusColor(status),
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: fontSize ?? 12,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
String _formatStatus(String status) {
|
|
switch (status.toLowerCase()) {
|
|
case 'pending':
|
|
return 'Pending';
|
|
case 'notstarted':
|
|
return 'Not Started';
|
|
case 'inprogress':
|
|
return 'In Progress';
|
|
case 'completed':
|
|
return 'Completed';
|
|
case 'failed':
|
|
return 'Failed';
|
|
case 'cancelled':
|
|
return 'Cancelled';
|
|
default:
|
|
return status;
|
|
}
|
|
}
|
|
}
|