Merge remote-tracking branch 'origin/design_3.0_sdk_upgrade' into design_3.0_sdk_upgrade

# Conflicts:
#	lib/models/new_models/work_order_detail_model.dart
design_3.0_latest
muhammad.abbasi 1 year ago
commit cc9b993de7

@ -13,6 +13,7 @@ class AppColor {
static const Color primary70 = Color(0xff163A51);
static const Color primary80 = Color(0xff161D27);
static const Color primary90 = Color(0xff1E95DE);
static const Color primary63 = Color(0xff63A4D1);
//texts
static const Color neutral10 = Color(0xffBCBCBC);
@ -32,7 +33,6 @@ class AppColor {
static const Color neutral150 = Color(0xffA1A1A1);
static const Color neutral160 = Color(0xffE5E5E5);
//background
static const Color backgroundLight = Color(0xfff7f9fb);
static const Color backgroundDark = Color(0xff111427);
@ -46,10 +46,12 @@ class AppColor {
static const Color white60 = Color(0xffEFEFEF);
static const Color white70 = Color(0xffF1F1F1);
static const Color white936 = Color(0xff212936);
//black
static const Color black10 = Color(0xff3B3D4A);
static const Color black20 = Color(0xff212936);
static const Color black35 = Color(0xff222A36);
static const Color black1E = Color(0xff1E1F20);
//red
static const Color red30 = Color(0xffF63939);
@ -63,7 +65,7 @@ class AppColor {
static const Color green50 = Color(0xff62BE96);
static const Color green60 = Color(0xff065E38);
static const Color green70 = Color(0xff54C166);
static const Color green15 = Color(0xff157D14);
//orange
static const Color orange30 = Color(0xffFDE19B);
@ -82,6 +84,7 @@ class AppColor {
// static Color yellowStatus(BuildContext context) => context.isDark ? const Color(0xffFFDA76) : orange40;
static Color yellowStatus(BuildContext context) => context.isDark ? const Color(0xffFFC945) : orange30;
static Color yellowIcon(BuildContext context) => context.isDark ? const Color(0xffFFC945) : orange70;
static Color background(BuildContext context) => context.isDark ? neutral60 : Colors.white;
@ -103,6 +106,40 @@ class AppColor {
}
}
static Color getHistoryLogStatusTextColorByName(String status) {
switch ((status).toLowerCase()) {
case "in progress":
return white936;
case "new":
return primary63;
case "closed":
return black1E;
case "completed":
return green15;
case "fixed":
return green15;
default:
return Colors.white;
}
}
static Color getHistoryLogStatusColorByName(String status) {
switch ((status).toLowerCase()) {
case "in progress":
return orange30;
case "new":
return primary10.withOpacity(.30);
case "closed":
return white936.withOpacity(.30);
case "completed":
return green70.withOpacity(.5);
case "fixed":
return green70.withOpacity(.5);
default:
return Colors.white;
}
}
static Color getRequestStatusColorByName(BuildContext context, String? status) {
switch ((status ?? "").toLowerCase()) {
case "medium":
@ -166,7 +203,7 @@ class AppColor {
case 81:
return Colors.white;
case 82:
//high priority
//high priority
return white10;
default:
return blueStatus(context);
@ -175,10 +212,10 @@ class AppColor {
static Color getPriorityStatusColor(BuildContext context, int id) {
switch (id) {
//low priority
//low priority
case 81:
return greenStatus(context);
//high priority
//high priority
case 82:
return redStatus(context);
default:

@ -5,6 +5,7 @@ import 'package:test_sa/extensions/int_extensions.dart';
import 'package:test_sa/extensions/string_extensions.dart';
import 'package:test_sa/extensions/text_extensions.dart';
import 'package:test_sa/extensions/widget_extensions.dart';
import 'package:test_sa/models/new_models/work_order_detail_model.dart';
import 'package:test_sa/new_views/app_style/app_color.dart';
import 'package:test_sa/service_request_latest/request_detail_provider.dart';
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
@ -28,6 +29,7 @@ class HistoryLogView extends StatelessWidget {
];
return Consumer<RequestDetailProvider>(builder: (context, requestProvider, _) {
String status = "";
return requestProvider.isLoading
? const CircularProgressIndicator(color: AppColor.primary10).center
: (requestProvider.currentWorkOrder == null || (requestProvider.currentWorkOrder?.data?.workOrderHistory.isEmpty ?? true)
@ -44,58 +46,81 @@ class HistoryLogView extends StatelessWidget {
endIndent: 10,
),
),
ListView.builder(
itemCount: dummyList.length,
padding: EdgeInsets.zero,
itemBuilder: (context, index) {
return historyLogCard(context: context, historyLogModel: dummyList[index]);
},
),
Builder(builder: (cxt) {
List<Widget> items = [];
String lastStatus = "";
for (var object in requestProvider.currentWorkOrder!.data!.workOrderHistory) {
String currentStatus = object.workorderStatus!.name!;
if (lastStatus.isEmpty) {
lastStatus = currentStatus;
}
if (lastStatus == currentStatus) {
items.add(historyLogCard(cxt, object));
} else {
items.add(statusCard(cxt, lastStatus));
lastStatus = currentStatus;
items.add(historyLogCard(cxt, object));
}
}
items.add(statusCard(cxt, lastStatus));
return SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: Column(children: items),
);
}),
],
));
});
}
Widget historyLogCard({required BuildContext context, required HistoryLogModel historyLogModel}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.end,
Widget historyLogCard(BuildContext context, WorkOrderHistory object) {
return Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
historyLogModel.status != null
? Padding(
padding: EdgeInsets.only(top: 16.toScreenHeight, bottom: 16.toScreenHeight, right: 89.toScreenWidth),
child: StatusLabel(
radius: 4,
label: historyLogModel.status,
textColor: AppColor.getRequestStatusTextColorByName(context, historyLogModel.status!),
backgroundColor: AppColor.getRequestStatusColorByName(context, historyLogModel.status!),
),
)
: 12.height,
Container(
width: double.infinity,
padding: EdgeInsets.only(left: 12.toScreenWidth, bottom: 16.toScreenHeight, top: 12.toScreenHeight),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
historyLogModel.date.toString().toServiceRequestCardFormat,
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
50.width,
Expanded(
child: historyLogModel.message.bodyText(context).custom(color: AppColor.black10),
),
],
),
],
Align(
alignment: Alignment.centerLeft,
child: Text(
object.date.toString().toServiceRequestCardFormat,
textAlign: TextAlign.end,
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral30 : AppColor.neutral120),
),
).toShadowContainer(context),
).expanded,
Expanded(
flex: 2,
child: object.step!.name!.bodyText(context).custom(color: AppColor.black10),
),
],
);
).toShadowContainer(context, padding: 16).paddingOnly(bottom: 16);
}
Widget statusCard(BuildContext context, String status) {
return SizedBox(
width: 153.toScreenWidth,
child: StatusLabel(
radius: 4,
label: statusText(status.toLowerCase()),
labelInCenter: true,
textColor: AppColor.getHistoryLogStatusTextColorByName(status),
backgroundColor: AppColor.getHistoryLogStatusColorByName(status),
),
).paddingOnly(bottom: 16, start: 40);
}
String statusText(String status) {
if (status == "new") {
return "Open Request".addTranslation;
} else if (status == "in progress") {
return "Status update to In Progress".addTranslation;
} else if (status == "closed") {
return "Status update to Closed".addTranslation;
} else if (status == "completed") {
return "Status update to Completed".addTranslation;
} else if (status == "fixed") {
return "Status update to Fixed".addTranslation;
} else
return status;
}
}

@ -9,8 +9,9 @@ class StatusLabel extends StatelessWidget {
final Color? textColor;
final bool isPriority;
final double radius;
final bool labelInCenter;
StatusLabel({Key? key, this.id = 0, this.label, this.backgroundColor, this.textColor, this.isPriority = false, this.radius = 4}) : super(key: key);
StatusLabel({Key? key, this.id = 0, this.label, this.backgroundColor, this.textColor, this.isPriority = false, this.radius = 4,this.labelInCenter=false}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -26,6 +27,7 @@ class StatusLabel extends StatelessWidget {
return Container(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 10),
alignment: labelInCenter ? Alignment.center: null,
decoration: ShapeDecoration(
color: backgroundColor,
shape: RoundedRectangleBorder(
@ -35,77 +37,4 @@ class StatusLabel extends StatelessWidget {
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;
// }
// }
}

Loading…
Cancel
Save