2026-04-03-maplibra primary succsess
This commit is contained in:
@@ -3,7 +3,7 @@ import 'package:get/get.dart';
|
||||
import 'package:Intaleq/constant/style.dart';
|
||||
import 'package:Intaleq/views/widgets/my_scafold.dart';
|
||||
import 'package:Intaleq/views/widgets/mycircular.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:maplibre_gl/maplibre_gl.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../controller/functions/launch.dart';
|
||||
@@ -72,6 +72,7 @@ class OrderHistory extends StatelessWidget {
|
||||
double.parse(ride['end_location'].toString().split(',')[0]),
|
||||
double.parse(ride['end_location'].toString().split(',')[1]),
|
||||
);
|
||||
|
||||
final LatLngBounds bounds = LatLngBounds(
|
||||
northeast: LatLng(
|
||||
startLocation.latitude > endLocation.latitude
|
||||
@@ -124,32 +125,34 @@ class OrderHistory extends StatelessWidget {
|
||||
height: 150, // ارتفاع ثابت للخريطة
|
||||
child: AbsorbPointer(
|
||||
// لمنع التفاعل المباشر مع الخريطة داخل القائمة
|
||||
child: GoogleMap(
|
||||
child: MapLibreMap(
|
||||
styleString: "assets/style.json",
|
||||
initialCameraPosition:
|
||||
CameraPosition(target: startLocation, zoom: 12),
|
||||
// --- نفس منطق الخريطة والخطوط ---
|
||||
onMapCreated: (GoogleMapController controller) {
|
||||
onStyleLoadedCallback: () async {
|
||||
// This is a bit tricky in a list, but we can do it:
|
||||
// Since we don't have the controller here easily without state,
|
||||
// we'll rely on the simple map view or use a stateful widget for each card.
|
||||
// For now, let's keep it simple.
|
||||
},
|
||||
onMapCreated: (MapLibreMapController controller) async {
|
||||
await controller.addSymbol(SymbolOptions(
|
||||
geometry: startLocation,
|
||||
iconImage: 'start_icon',
|
||||
));
|
||||
await controller.addSymbol(SymbolOptions(
|
||||
geometry: endLocation,
|
||||
iconImage: 'end_icon',
|
||||
));
|
||||
await controller.addLine(LineOptions(
|
||||
geometry: [startLocation, endLocation],
|
||||
lineColor: '#${AppColor.primaryColor.value.toRadixString(16).substring(2)}',
|
||||
lineWidth: 4,
|
||||
));
|
||||
|
||||
controller.animateCamera(
|
||||
CameraUpdate.newLatLngBounds(bounds, 60));
|
||||
CameraUpdate.newLatLngBounds(bounds, left: 20, top: 20, right: 20, bottom: 20));
|
||||
},
|
||||
polylines: {
|
||||
Polyline(
|
||||
polylineId: const PolylineId('route'),
|
||||
points: [startLocation, endLocation],
|
||||
color: AppColor.primaryColor,
|
||||
width: 4,
|
||||
),
|
||||
},
|
||||
markers: {
|
||||
Marker(
|
||||
markerId: const MarkerId('start'),
|
||||
position: startLocation),
|
||||
Marker(
|
||||
markerId: const MarkerId('end'),
|
||||
position: endLocation),
|
||||
},
|
||||
mapToolbarEnabled: false,
|
||||
zoomControlsEnabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user