import 'package:flutter/material.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 'package:test_sa/views/widgets/item_views/info_header_widget.dart'; import 'package:test_sa/views/widgets/item_views/info_text_widget.dart'; import 'package:test_sa/views/widgets/requests/request_status.dart'; import 'models/asset_tracking_model.dart'; class AssetTrackingListItemView extends StatelessWidget { final AssetTrackingModel asset; bool isGridView; bool showViewOnMap; AssetTrackingListItemView(this.asset, this.isGridView, {Key? key, this.showViewOnMap = true}) : super(key: key); @override Widget build(BuildContext context) { return Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ StatusLabel( label: (asset.location?.isLive ?? false) ? "Live" : "Not Live", radius: 4, textColor: AppColor.getPriorityStatusTextColor(context, (asset.location?.isLive ?? false) ? 0 : 1), backgroundColor: AppColor.getPriorityStatusColor(context, (asset.location?.isLive ?? false) ? 0 : 1), ), 4.height, isGridView ? InfoHeaderWidget(asset.label ?? "") : InfoHeader16Widget(asset.label ?? ""), InfoTextWidget(label: "Serial No", value: asset.label, showEmptyValue: true), InfoTextWidget(label: "Type", value: asset.type?.name, showEmptyValue: true), InfoTextWidget(label: "Status", value: asset.status?.name, showEmptyValue: true), InfoTextWidget(label: "Department", value: asset.department?.name, showEmptyValue: true), InfoTextWidget( label: "Last seen", value: asset.location?.lastSeen?.toServiceRequestDetailsFormat, showEmptyValue: true, showArrow: showViewOnMap ? (isGridView ? false : true) : false, arrowMsg: showViewOnMap ? (isGridView ? "" : "View on map") : "", ), if (showViewOnMap && isGridView) ...[ 5.height, InfoTextWidget( label: "View on map", value: '', showEmptyValue: true, showArrow: true, ), ], ], ).toShadowContainer(context); } }