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.
70 lines
2.8 KiB
Dart
70 lines
2.8 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/new_views/app_style/app_color.dart';
|
|
import '../models/cleaner_task_search_result.dart';
|
|
|
|
class CleanerRequestItemView extends StatelessWidget {
|
|
final CleanerTaskSearchResult result;
|
|
final VoidCallback? onTap;
|
|
final bool showShadow;
|
|
|
|
const CleanerRequestItemView({Key? key, required this.result, this.onTap, this.showShadow = true}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
// Task Number and Date Row
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
if (result.taskNo != null && result.taskNo!.isNotEmpty) result.taskNo!.heading5(context),
|
|
if (result.createdDate != null)
|
|
Text(
|
|
result.createdDate!.toServiceRequestCardFormat,
|
|
textAlign: TextAlign.end,
|
|
style: AppTextStyles.tinyFont.copyWith(
|
|
color: context.isDark ? AppColor.neutral10 : AppColor.neutral50,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
8.height,
|
|
|
|
// Location Information
|
|
if (result.siteName != null && result.siteName!.isNotEmpty) 'Site: ${result.siteName}'.bodyText(context),
|
|
if (result.buildingName != null && result.buildingName!.isNotEmpty) 'Building: ${result.buildingName}'.bodyText(context),
|
|
if (result.floorName != null && result.floorName!.isNotEmpty) 'Floor: ${result.floorName}'.bodyText(context),
|
|
if (result.departmentName != null && result.departmentName!.isNotEmpty) 'Department: ${result.departmentName}'.bodyText(context),
|
|
if (result.roomName != null && result.roomName!.isNotEmpty) 'Room: ${result.roomName}'.bodyText(context),
|
|
if (result.locationDescription != null && result.locationDescription!.isNotEmpty) 'Location: ${result.locationDescription}'.bodyText(context),
|
|
|
|
8.height,
|
|
|
|
// View Details Link
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
context.translation.viewDetails,
|
|
style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
|
),
|
|
4.width,
|
|
Icon(
|
|
Icons.arrow_forward,
|
|
color: AppColor.blueStatus(context),
|
|
size: 14,
|
|
)
|
|
],
|
|
),
|
|
],
|
|
).toShadowContainer(context, withShadow: showShadow).onPress(onTap);
|
|
}
|
|
}
|