|
|
|
|
@ -1,11 +1,16 @@
|
|
|
|
|
import 'dart:async';
|
|
|
|
|
import 'dart:typed_data';
|
|
|
|
|
import 'dart:ui' as ui;
|
|
|
|
|
|
|
|
|
|
import 'package:async/async.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/config/config.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/order_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/service/parmacyModule/order-preview-service.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/locator.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
import 'package:flutter_animarker/lat_lng_interpolation.dart';
|
|
|
|
|
import 'package:flutter_animarker/models/lat_lng_delta.dart';
|
|
|
|
|
import 'package:flutter_animarker/models/lat_lng_info.dart';
|
|
|
|
|
@ -104,7 +109,12 @@ class _TrackDriverState extends State<TrackDriver> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
|
|
return new Scaffold(
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
appBarTitle: TranslationBase.of(context).deliveryDriverTrack,
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
isPharmacy: true,
|
|
|
|
|
showPharmacyCart: false,
|
|
|
|
|
showHomeAppBarIcon: false,
|
|
|
|
|
body: GoogleMap(
|
|
|
|
|
myLocationEnabled: true,
|
|
|
|
|
compassEnabled: true,
|
|
|
|
|
@ -127,13 +137,10 @@ class _TrackDriverState extends State<TrackDriver> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setSourceAndDestinationIcons() async {
|
|
|
|
|
sourceIcon = await BitmapDescriptor.fromAssetImage(
|
|
|
|
|
ImageConfiguration(devicePixelRatio: 2.5),
|
|
|
|
|
'assets/images/map_markers/source_map_marker.png');
|
|
|
|
|
|
|
|
|
|
destinationIcon = await BitmapDescriptor.fromAssetImage(
|
|
|
|
|
ImageConfiguration(devicePixelRatio: 2.5),
|
|
|
|
|
'assets/images/map_markers/destination_map_marker.png');
|
|
|
|
|
final Uint8List srcMarkerBytes = await getBytesFromAsset('assets/images/map_markers/source_map_marker.png', getMarkerIconSize());
|
|
|
|
|
final Uint8List destMarkerBytes = await getBytesFromAsset('assets/images/map_markers/destination_map_marker.png', getMarkerIconSize());
|
|
|
|
|
sourceIcon = await BitmapDescriptor.fromBytes(srcMarkerBytes);
|
|
|
|
|
destinationIcon = await BitmapDescriptor.fromBytes(destMarkerBytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CameraPosition _orderDeliveryLocationCamera(){
|
|
|
|
|
@ -298,4 +305,15 @@ class _TrackDriverState extends State<TrackDriver> {
|
|
|
|
|
stopUpdatingDriverLocation(){
|
|
|
|
|
isLocationUpdating = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<Uint8List> getBytesFromAsset(String path, int width) async {
|
|
|
|
|
ByteData data = await rootBundle.load(path);
|
|
|
|
|
ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width);
|
|
|
|
|
ui.FrameInfo fi = await codec.getNextFrame();
|
|
|
|
|
return (await fi.image.toByteData(format: ui.ImageByteFormat.png)).buffer.asUint8List();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int getMarkerIconSize(){
|
|
|
|
|
return 140;
|
|
|
|
|
}
|
|
|
|
|
}
|