track service request cont.
parent
150ad60de6
commit
392182e234
@ -0,0 +1,8 @@
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
extension StringExtensions on String {
|
||||
String get toServiceRequestCardFormat {
|
||||
DateTime dateTime = DateTime.tryParse(this);
|
||||
return "${DateFormat('dd MMM, yyyy').format(dateTime)}\n${DateFormat('hh:mm a').format(dateTime)}";
|
||||
}
|
||||
}
|
||||
@ -1,24 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:test_sa/extensions/text_extensions.dart';
|
||||
import 'package:test_sa/views/app_style/colors.dart';
|
||||
import 'package:test_sa/views/app_style/sizing.dart';
|
||||
|
||||
class StatusLabel extends StatelessWidget {
|
||||
final String label;
|
||||
final Color color;
|
||||
String label;
|
||||
final int id;
|
||||
final Color backgroundColor;
|
||||
final Color textColor;
|
||||
final bool isPriority;
|
||||
|
||||
const StatusLabel({Key key, this.label, this.color}) : super(key: key);
|
||||
StatusLabel({Key key, this.id, this.label, this.backgroundColor, this.textColor, this.isPriority = false}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (id == 82) label = "High Priority";
|
||||
if (id == 81) label = "Low Priority";
|
||||
|
||||
print("label:$label:$id");
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 2, horizontal: 8),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(color: color ?? Colors.green, borderRadius: BorderRadius.circular(AppStyle.getBorderRadius(context)), boxShadow: [AppStyle.boxShadow]),
|
||||
child: Text(
|
||||
label ?? "no status",
|
||||
style: Theme.of(context).textTheme.subtitle2.copyWith(
|
||||
color: color.computeLuminance() > 0.5 ? AColors.black : Colors.white,
|
||||
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 10),
|
||||
decoration: ShapeDecoration(
|
||||
color: backgroundColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
),
|
||||
));
|
||||
child: Text(label.toUpperCase(), 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.statusBlueLight;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue