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.
139 lines
6.0 KiB
Dart
139 lines
6.0 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/widget_extensions.dart';
|
|
|
|
import '../../../extensions/text_extensions.dart';
|
|
import '../../../models/new_models/gas_refill_model.dart';
|
|
import '../../app_style/colors.dart';
|
|
import '../requests/request_status.dart';
|
|
|
|
class GasRefillItem extends StatelessWidget {
|
|
final int index;
|
|
final GasRefillModel item;
|
|
final Function(GasRefillModel) onPressed;
|
|
|
|
const GasRefillItem({Key key, this.item, this.onPressed, this.index}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
/// TBD
|
|
// StatusLabel(
|
|
// label: ,
|
|
// id: ,
|
|
// textColor: AColors.getPriorityStatusTextColor(),
|
|
// backgroundColor: AColors.getPriorityStatusColor()),
|
|
// 8.width,
|
|
StatusLabel(label: item.status.name, textColor: AColors.getRequestStatusTextColor(item.status.value), backgroundColor: AColors.getRequestStatusColor(item.status.value)),
|
|
1.width.expanded,
|
|
Text(item.startDate != null ? item.startDate.toServiceRequestCardFormat : "", textAlign: TextAlign.end, style: AppTextStyles.tinyFont.copyWith(color: const Color(0xFF3B3D4A))),
|
|
],
|
|
),
|
|
8.height,
|
|
Text(context.translation.gasRefillRequest, style: AppTextStyles.heading5.copyWith(color: const Color(0xFF3B3D4A))),
|
|
Text(
|
|
'${context.translation.gasType}: ${item.gazRefillDetails[0].gasType.name}',
|
|
style: AppTextStyles.bodyText.copyWith(color: Color(0xFF757575)),
|
|
),
|
|
Text(
|
|
'${context.translation.site}: ${item.site.name}',
|
|
style: AppTextStyles.bodyText.copyWith(color: 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(item)),
|
|
// Row(
|
|
// children: [
|
|
// Expanded(
|
|
// child: Column(
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
// children: [
|
|
// Text(
|
|
// item.title ?? "-----",
|
|
// style: Theme.of(context).textTheme.titleLarge.copyWith(color: onItemColor, fontSize: 16, fontWeight: FontWeight.bold),
|
|
// ),
|
|
// Row(
|
|
// children: [
|
|
// Expanded(
|
|
// child: Text(
|
|
// subtitle.hospital,
|
|
// style: Theme.of(context).textTheme.titleSmall.copyWith(
|
|
// color: onItemColor,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// if (item.clientName != null)
|
|
// Text(
|
|
// item.clientName,
|
|
// style: Theme.of(context).textTheme.titleSmall.copyWith(
|
|
// color: onItemColor,
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// Divider(color: onItemColor),
|
|
// Row(
|
|
// children: [
|
|
// Expanded(
|
|
// child: Text(subtitle.status, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
|
|
// ),
|
|
// if (item.status?.id != null) StatusLabel(label: item.status.name, color: AColors.getGasStatusColor(item.status.id)),
|
|
// ],
|
|
// ),
|
|
// if (item?.expectedDate != null) Divider(color: onItemColor),
|
|
// if (item?.expectedDate != null)
|
|
// Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
// children: [
|
|
// Text("Expected Date", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
|
|
// Text(item.expectedDate.toIso8601String().split("T").first, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
|
|
// ],
|
|
// ),
|
|
// if (item?.details?.isNotEmpty ?? false) Divider(color: onItemColor),
|
|
// Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
// children: [
|
|
// if (item?.details?.isNotEmpty ?? false) Text("Gas Type", style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor)),
|
|
// Column(
|
|
// crossAxisAlignment: CrossAxisAlignment.end,
|
|
// children: item.details
|
|
// .map(
|
|
// (gas) => gas?.type?.name?.isNotEmpty ?? false
|
|
// ? Text(gas?.type?.name, style: Theme.of(context).textTheme.titleSmall.copyWith(color: onItemColor))
|
|
// : const SizedBox.shrink(),
|
|
// )
|
|
// .toList(),
|
|
// )
|
|
// ],
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
],
|
|
).toShadowContainer(context).paddingOnly(bottom: 8);
|
|
}
|
|
}
|