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.
92 lines
4.1 KiB
Dart
92 lines
4.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
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/service_request/service_request.dart';
|
|
import 'package:test_sa/views/widgets/requests/request_status.dart';
|
|
|
|
import '../../../new_views/app_style/app_color.dart';
|
|
|
|
class ServiceRequestItem extends StatelessWidget {
|
|
final int index;
|
|
final ServiceRequest request;
|
|
final Function(ServiceRequest) onPressed;
|
|
|
|
const ServiceRequestItem({Key? key, required this.request, required this.onPressed, required this.index}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// User _user = Provider.of<UserProvider>(context, listen: false).user;
|
|
// final servicesProvider = Provider.of<ServiceRequestsProvider>(context, listen: false);
|
|
// final settingProvider = Provider.of<SettingProvider>(context, listen: false);
|
|
// Color itemColor = index % 2 == 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
|
|
// Color onItemColor = index % 2 != 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onPrimary;
|
|
|
|
return Column(
|
|
children: [
|
|
Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
StatusLabel(
|
|
label: request.priority!.name,
|
|
id: request.priority!.id!,
|
|
/* textColor: AColors.getPriorityStatusTextColor(request.priority.id),
|
|
backgroundColor: AColors.getPriorityStatusColor(request.priority.id)*/
|
|
),
|
|
8.width,
|
|
StatusLabel(
|
|
label: request.statusLabel, /*textColor: AColors.getRequestStatusTextColor(request.statusValue), backgroundColor: AColors.getRequestStatusColor(request.statusValue)*/
|
|
),
|
|
1.width.expanded,
|
|
Text(request.date!.toServiceRequestCardFormat, textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral30 : const Color(0xFF3B3D4A))),
|
|
],
|
|
),
|
|
8.height,
|
|
Text(context.translation.serviceRequest, style: AppTextStyles.heading5.copyWith(color: context.isDark ? AppColor.neutral30 : const Color(0xFF3B3D4A))),
|
|
Text(
|
|
'${context.translation.assetName}: ${request.deviceEnName}',
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : const Color(0xFF757575)),
|
|
),
|
|
Text(
|
|
'${context.translation.assetNumber}: ${request.device!.assetNumber}',
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : const Color(0xFF757575)),
|
|
),
|
|
Text(
|
|
'${context.translation.requestType}: ${request.type!.name}',
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : const Color(0xFF757575)),
|
|
),
|
|
Text(
|
|
'${context.translation.requestNo}: ${request.requestCode}',
|
|
style: AppTextStyles.bodyText.copyWith(color: context.isDark ? AppColor.neutral10 : const Color(0xFF757575)),
|
|
),
|
|
8.height,
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
context.translation.viewDetails,
|
|
style: AppTextStyles.bodyText.copyWith(color: const Color(0xFF4A8DB7)),
|
|
),
|
|
4.width,
|
|
const Icon(
|
|
Icons.arrow_forward,
|
|
color: Color(0xFF4A8DB7),
|
|
size: 14,
|
|
)
|
|
],
|
|
),
|
|
],
|
|
).onPress(() {
|
|
onPressed(request);
|
|
}).toShadowContainer(context),
|
|
],
|
|
);
|
|
}
|
|
}
|