|
|
|
|
@ -18,6 +18,7 @@ import 'package:test_sa/new_views/common_widgets/default_app_bar.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/multiple_item_drop_down_menu.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/single_item_drop_down_menu.dart';
|
|
|
|
|
import 'package:test_sa/providers/loading_list_notifier.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 'asset_tracking_item_view.dart';
|
|
|
|
|
@ -190,17 +191,7 @@ class _MapTrackingPageState extends State<MapTrackingPage> {
|
|
|
|
|
setState(() {
|
|
|
|
|
_geojson = decoded;
|
|
|
|
|
_computedBounds = bounds;
|
|
|
|
|
markers = [
|
|
|
|
|
if (hasAssetPosition)
|
|
|
|
|
Marker(
|
|
|
|
|
point: LatLng(assetLocation!.latitude!, assetLocation.longitude!),
|
|
|
|
|
child: Tooltip(
|
|
|
|
|
triggerMode: TooltipTriggerMode.tap,
|
|
|
|
|
message: "${widget.assetTrackingData?.label ?? ''}\nLast seen: ${widget.assetTrackingData?.location?.lastSeen?.toServiceRequestDetailsFormat}",
|
|
|
|
|
child: const Icon(Icons.location_pin, color: AppColor.red30),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
markers = [if (hasAssetPosition) _buildAssetMarker(widget.assetTrackingData!)];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
@ -370,11 +361,9 @@ class _MapTrackingPageState extends State<MapTrackingPage> {
|
|
|
|
|
Marker _buildAssetMarker(AssetTrackingModel asset) {
|
|
|
|
|
return Marker(
|
|
|
|
|
point: LatLng(asset.location!.latitude!, asset.location!.longitude!),
|
|
|
|
|
child: Tooltip(
|
|
|
|
|
triggerMode: TooltipTriggerMode.tap,
|
|
|
|
|
message: "${asset.label ?? ''}\nLast seen: ${asset.location?.lastSeen?.toServiceRequestDetailsFormat}",
|
|
|
|
|
child: const Icon(Icons.location_pin, color: AppColor.red30),
|
|
|
|
|
),
|
|
|
|
|
child: const Icon(Icons.location_pin, color: AppColor.red30).onPress(() {
|
|
|
|
|
_showAssetDetails(asset);
|
|
|
|
|
}),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -420,6 +409,36 @@ class _MapTrackingPageState extends State<MapTrackingPage> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void _showAssetDetails(AssetTrackingModel asset) {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (sheetContext) {
|
|
|
|
|
return Container(
|
|
|
|
|
constraints: BoxConstraints(maxHeight: MediaQuery.of(sheetContext).size.height * 0.6),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: AppColor.background(sheetContext),
|
|
|
|
|
borderRadius: const BorderRadius.vertical(top: Radius.circular(20)),
|
|
|
|
|
),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(16),
|
|
|
|
|
child: SafeArea(
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
spacing: 8,
|
|
|
|
|
children: [
|
|
|
|
|
Text("Asset Information", style: AppTextStyles.heading5.copyWith(color: AppColor.textColor(sheetContext))),
|
|
|
|
|
AssetTrackingListItemView(asset, false, showViewOnMap: false),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
double _dragPosition = 0.5;
|
|
|
|
|
late double _sheetPosition = _dragPosition;
|
|
|
|
|
final minChildSize = 0.25;
|
|
|
|
|
|