You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
3.4 KiB
Dart
112 lines
3.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
class StatusLabel extends StatelessWidget {
|
|
String? label;
|
|
final int id;
|
|
final Color? backgroundColor;
|
|
final Color? textColor;
|
|
final bool isPriority;
|
|
final double radius;
|
|
|
|
StatusLabel({Key? key, this.id = 0, this.label, this.backgroundColor, this.textColor, this.isPriority = false, this.radius = 4}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (id == 82) label = context.translation.highPriority;
|
|
if (id == 81) label = context.translation.lowPriority;
|
|
if (label?.toLowerCase() == 'In progress'.toLowerCase()) label = context.translation.inProgress;
|
|
if (label?.toLowerCase() == 'Completed'.toLowerCase()) label = context.translation.completed;
|
|
if (label?.toLowerCase() == 'Open'.toLowerCase()) label = context.translation.open;
|
|
if (label?.toLowerCase() == 'Closed'.toLowerCase()) label = context.translation.closed;
|
|
if (label?.toLowerCase() == 'Low'.toLowerCase()) label = context.translation.lowPriority;
|
|
if (label?.toLowerCase() == 'High'.toLowerCase()) label = context.translation.highPriority;
|
|
if (label?.toLowerCase() == 'Waiting for quotation'.toLowerCase()) label = context.translation.waitingForQuotation;
|
|
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 10),
|
|
decoration: ShapeDecoration(
|
|
color: backgroundColor,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(radius),
|
|
),
|
|
),
|
|
child: Text(label ?? "", style: AppTextStyles.overline.copyWith(color: textColor)),
|
|
);
|
|
}
|
|
|
|
// Color getRequestStatusColor1(String status) {
|
|
// switch (status) {
|
|
// case "in progress":
|
|
// return AColors.statusYellowLight;
|
|
// case "completed":
|
|
// return AColors.statusGreenLight;
|
|
// case "high priority":
|
|
// return AColors.statusRedLight;
|
|
// case "low priority":
|
|
// return AColors.statusGreenLight;
|
|
// case "open":
|
|
// return AColors.statusBlue;
|
|
// default:
|
|
// return AColors.statusDefault;
|
|
// }
|
|
// }
|
|
//
|
|
// Color getRequestStatusTextColor(String status) {
|
|
// switch (status) {
|
|
// case "in progress":
|
|
// return AColors.statusYellow;
|
|
// case "completed":
|
|
// return AColors.statusGreen;
|
|
// case "high priority":
|
|
// return AColors.statusRed;
|
|
// case "low priority":
|
|
// return AColors.statusGreen;
|
|
// case "open":
|
|
// return AColors.statusBlue;
|
|
// default:
|
|
// return Colors.white;
|
|
// }
|
|
// }
|
|
//
|
|
// static Color getRequestStatusColor(int id) {
|
|
// switch (id) {
|
|
// case 4:
|
|
// return AColors.deepRed;
|
|
// case 6:
|
|
// return AColors.green;
|
|
// case 5:
|
|
// return AColors.orange;
|
|
// case 8:
|
|
// return AColors.green;
|
|
// case 9:
|
|
// return AColors.orange;
|
|
// default:
|
|
// return AColors.grey;
|
|
// }
|
|
// }
|
|
//
|
|
// static Color getGasStatusColor(int id) {
|
|
// switch (id) {
|
|
// case 0:
|
|
// return AColors.orange;
|
|
// case 1:
|
|
// return AColors.green;
|
|
// default:
|
|
// return AColors.grey;
|
|
// }
|
|
// }
|
|
//
|
|
// static Color getPriorityStatusColor(int id) {
|
|
// switch (id) {
|
|
// case 0:
|
|
// return AColors.orange;
|
|
// case 1:
|
|
// return AColors.green;
|
|
// default:
|
|
// return AColors.grey;
|
|
// }
|
|
// }
|
|
}
|