45 lines
1.0 KiB
Dart
45 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class StatusChip extends StatelessWidget {
|
|
final String status;
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final color = _color();
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
|
decoration: BoxDecoration(
|
|
color: color.withAlpha(25),
|
|
borderRadius: BorderRadius.circular(8),
|
|
border: Border.all(color: color.withAlpha(80)),
|
|
),
|
|
child: Text(
|
|
status,
|
|
style: TextStyle(
|
|
fontSize: 11,
|
|
fontWeight: FontWeight.w600,
|
|
color: color,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|