Fix geopoint doesn't working

This commit is contained in:
Thomas Fransolet 2025-11-27 16:51:43 +01:00
parent 5c318b39dd
commit d212f9f31c
7 changed files with 37 additions and 24 deletions

View File

@ -32,6 +32,26 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct
});
}
var defaultPosition = LatLong(50.429333, 4.891434); // Default Namur
var pointPosition;
if(geoPointDTO.geometry != null) {
switch(geoPointDTO.geometry!.type) {
case "Point":
var coordinates = geoPointDTO.geometry!.coordinates as List<dynamic>;
pointPosition = LatLong(coordinates.first, coordinates.last);
break;
case "LineString":
pointPosition = LatLong(50.429333, 4.891434); // TODO default Namur
break;
case "Polygon":
pointPosition = LatLong(50.429333, 4.891434); // TODO default Namur
break;
}
}
LatLong initPosition = geoPointDTO.geometry == null ? defaultPosition : pointPosition;
Size size = MediaQuery.of(context).size;
showDialog(
builder: (BuildContext context) => AlertDialog(
@ -51,7 +71,7 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct
height: 350,
child: FlutterLocationPicker(
initZoom: 14,
initPosition: /*geoPointDTO.latitude == null && geoPointDTO.longitude == null ?*/ LatLong(50.429333, 4.891434) /*: LatLong(double.parse(geoPointDTO.latitude!), double.parse(geoPointDTO.longitude!))*/,
initPosition: initPosition,
minZoomLevel: 0,
maxZoomLevel: 17,
markerIcon: const Icon(
@ -78,13 +98,12 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct
onError: (e) => print(e),
selectLocationButtonLeadingIcon: const Icon(Icons.check, color: kPrimaryColor),
onPicked: (pickedData) {
print("TODO !");
/*geoPointDTO.latitude = pickedData.latLong.latitude.toString();
geoPointDTO.longitude = pickedData.latLong.longitude.toString();*/
geoPointDTO.geometry = new GeometryDTO(type: "Point", coordinates: [pickedData.latLong.latitude, pickedData.latLong.longitude]);
},
onChanged: (pickedData) {
/*print("onChanged");
print(pickedData.latLong.latitude);
print("onChanged");
geoPointDTO.geometry = new GeometryDTO(type: "Point", coordinates: [pickedData.latLong.latitude, pickedData.latLong.longitude]);
/*print(pickedData.latLong.latitude);
print(pickedData.latLong.longitude);
print(pickedData.address);
print(pickedData.addressData);*/
@ -353,11 +372,11 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct
color: kPrimaryColor,
textColor: kWhite,
press: () {
print("TODO");
/*if (geoPointDTO.latitude != null && geoPointDTO.longitude != null) {
//print("TODO");
if (geoPointDTO.geometry != null && geoPointDTO.geometry!.coordinates != null) {
getResult(geoPointDTO);
Navigator.of(context).pop();
}*/
}
},
fontSize: 20,
),

View File

@ -1,4 +1,4 @@
// Openapi Generator last run: : 2025-11-21T15:08:31.489558
// Openapi Generator last run: : 2025-11-27T16:46:46.408321
import 'package:openapi_generator_annotations/openapi_generator_annotations.dart';
@Openapi(

View File

@ -4,7 +4,7 @@
"info": {
"title": "Manager Service",
"description": "API Manager Service",
"version": "Version Alpha"
"version": "Version Alpha 0.0"
},
"servers": [
{
@ -4341,7 +4341,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GeoPoint"
"$ref": "#/components/schemas/GeoPointDTO"
}
}
}

View File

@ -281,9 +281,3 @@ lib/model/video_dto.dart
lib/model/weather_dto.dart
lib/model/web_dto.dart
pubspec.yaml
test/game_dto_all_of_puzzle_image_test.dart
test/game_dto_test.dart
test/game_types_test.dart
test/guided_path_section_game_test.dart
test/section_game_all_of_game_puzzle_image_test.dart
test/section_game_test.dart

View File

@ -3,7 +3,7 @@ API Manager Service
This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: Version Alpha
- API version: Version Alpha 0.0
- Generator version: 7.9.0
- Build package: org.openapitools.codegen.languages.DartClientCodegen

View File

@ -417,7 +417,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **sectionMapUpdate**
> GeoPoint sectionMapUpdate(geoPointDTO)
> GeoPointDTO sectionMapUpdate(geoPointDTO)
@ -446,7 +446,7 @@ Name | Type | Description | Notes
### Return type
[**GeoPoint**](GeoPoint.md)
[**GeoPointDTO**](GeoPointDTO.md)
### Authorization

View File

@ -577,7 +577,7 @@ class SectionMapApi {
/// Parameters:
///
/// * [GeoPointDTO] geoPointDTO (required):
Future<GeoPoint?> sectionMapUpdate(
Future<GeoPointDTO?> sectionMapUpdate(
GeoPointDTO geoPointDTO,
) async {
final response = await sectionMapUpdateWithHttpInfo(
@ -593,8 +593,8 @@ class SectionMapApi {
response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'GeoPoint',
) as GeoPoint;
'GeoPointDTO',
) as GeoPointDTO;
}
return null;
}