mirror of
https://bitbucket.org/FransoletThomas/tablet-app.git
synced 2025-12-06 08:31:19 +00:00
Handling MapBox (wip) in map and agenda + PDF new view (list)
This commit is contained in:
parent
fbfd7e26b7
commit
c8224b1e35
BIN
assets/icons/marker.png
Normal file
BIN
assets/icons/marker.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@ -7,7 +7,6 @@ import 'dart:ui' as ui;
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_api/api.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tablet_app/Components/loading_common.dart';
|
||||
import 'package:tablet_app/Models/agenda.dart';
|
||||
@ -135,7 +134,7 @@ class _AgendaView extends State<AgendaView> {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return EventPopup(eventAgenda: eventAgenda);
|
||||
return EventPopup(eventAgenda: eventAgenda, mapProvider: agendaDTO.mapProvider ?? MapProvider.Google);
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
@ -1,22 +1,28 @@
|
||||
import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:mapbox_maps_flutter/mapbox_maps_flutter.dart' as mapBox;
|
||||
import 'package:manager_api/api.dart';
|
||||
import 'package:tablet_app/Components/loading_common.dart';
|
||||
import 'package:tablet_app/Components/video_viewer_youtube.dart';
|
||||
import 'package:tablet_app/Models/agenda.dart'; // Assurez-vous d'importer votre modèle d'agenda
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:tablet_app/constants.dart';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
class EventPopup extends StatefulWidget {
|
||||
final EventAgenda eventAgenda;
|
||||
final MapProvider mapProvider;
|
||||
|
||||
EventPopup({Key? key, required this.eventAgenda}) : super(key: key);
|
||||
EventPopup({Key? key, required this.eventAgenda, required this.mapProvider}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<EventPopup> createState() => _EventPopupState();
|
||||
@ -28,6 +34,9 @@ class _EventPopupState extends State<EventPopup> {
|
||||
Set<Marker> markers = {};
|
||||
bool init = false;
|
||||
|
||||
mapBox.MapboxMap? mapboxMap;
|
||||
mapBox.PointAnnotationManager? pointAnnotationManager;
|
||||
|
||||
Set<Marker> getMarkers() {
|
||||
markers = {};
|
||||
|
||||
@ -46,6 +55,51 @@ class _EventPopupState extends State<EventPopup> {
|
||||
return markers;
|
||||
}
|
||||
|
||||
_onMapCreated(mapBox.MapboxMap mapboxMap, Uint8List icon) {
|
||||
this.mapboxMap = mapboxMap;
|
||||
|
||||
mapboxMap.annotations.createPointAnnotationManager().then((pointAnnotationManager) async {
|
||||
this.pointAnnotationManager = pointAnnotationManager;
|
||||
pointAnnotationManager.createMulti(createPoints(LatLng(widget.eventAgenda.address!.lat, widget.eventAgenda.address!.lng), icon));
|
||||
init = true;
|
||||
});
|
||||
}
|
||||
|
||||
createPoints(LatLng position, Uint8List icon) {
|
||||
var options = <mapBox.PointAnnotationOptions>[];
|
||||
options.add(mapBox.PointAnnotationOptions(
|
||||
geometry: mapBox.Point(
|
||||
coordinates: mapBox.Position(
|
||||
position.longitude,
|
||||
position.latitude,
|
||||
)).toJson(),
|
||||
iconSize: 1.3,
|
||||
iconOffset: [0.0, 0.0],
|
||||
symbolSortKey: 10,
|
||||
iconColor: 0,
|
||||
iconImage: null,
|
||||
image: icon, //widget.selectedMarkerIcon,
|
||||
));
|
||||
print(options.length);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
getByteIcon() async {
|
||||
final ByteData bytes = await rootBundle.load('assets/icons/marker.png');
|
||||
var icon = await getBytesFromAsset(bytes, 25);
|
||||
return icon;
|
||||
}
|
||||
|
||||
Future<Uint8List> getBytesFromAsset(ByteData data, 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();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -235,7 +289,8 @@ class _EventPopupState extends State<EventPopup> {
|
||||
SizedBox(
|
||||
width: size.width * 0.28,
|
||||
height: size.height * 0.2,
|
||||
child: GoogleMap(
|
||||
child: widget.mapProvider == MapProvider.Google ?
|
||||
GoogleMap(
|
||||
mapToolbarEnabled: false,
|
||||
initialCameraPosition: CameraPosition(
|
||||
target: LatLng(double.parse(widget.eventAgenda.address!.lat!.toString()), double.parse(widget.eventAgenda.address!.lng!.toString())),
|
||||
@ -245,6 +300,33 @@ class _EventPopupState extends State<EventPopup> {
|
||||
_controller.complete(controller);
|
||||
},
|
||||
markers: markers,
|
||||
) :
|
||||
FutureBuilder(
|
||||
future: getByteIcon(),
|
||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
Uint8List icon = snapshot.data!;
|
||||
return mapBox.MapWidget(
|
||||
key: ValueKey("mapBoxWidget"),
|
||||
styleUri: mapBox.MapboxStyles.STANDARD,
|
||||
onMapCreated: (maBoxMap) {
|
||||
_onMapCreated(maBoxMap, icon);
|
||||
},
|
||||
cameraOptions: mapBox.CameraOptions(
|
||||
center: mapBox.Point(coordinates: mapBox.Position(double.parse(widget.eventAgenda.address!.lng!.toString()), double.parse(widget.eventAgenda.address!.lat!.toString()))).toJson(),
|
||||
zoom: 14
|
||||
),
|
||||
);
|
||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||
return Text("No data");
|
||||
} else {
|
||||
return Center(
|
||||
child: Container(
|
||||
child: LoadingCommon()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
),
|
||||
): SizedBox(),
|
||||
SizedBox(
|
||||
|
||||
@ -18,7 +18,7 @@ import 'package:tablet_app/Helpers/DeviceInfoHelper.dart';
|
||||
import 'package:tablet_app/Helpers/ImageCustomProvider.dart';
|
||||
import 'package:tablet_app/Helpers/MQTTHelper.dart';
|
||||
import 'package:tablet_app/Models/tabletContext.dart';
|
||||
import 'package:tablet_app/Screens/MainView/dropDown_configuration.dart';
|
||||
import 'package:tablet_app/Screens/Configuration/dropDown_configuration.dart';
|
||||
import 'package:tablet_app/Screens/MainView/main_view.dart';
|
||||
import 'package:tablet_app/app_context.dart';
|
||||
import 'package:tablet_app/client.dart';
|
||||
|
||||
@ -54,12 +54,7 @@ class _MapBoxViewState extends State<MapBoxView> {
|
||||
late mapBox.MapboxMap? mapboxMap;
|
||||
late mapBox.PointAnnotationManager? pointAnnotationManager;
|
||||
|
||||
_onMapCreated(mapBox.MapboxMap mapboxMap, MapContext mapContext) {
|
||||
this.mapboxMap = mapboxMap;
|
||||
|
||||
mapboxMap.annotations.createPointAnnotationManager().then((pointAnnotationManager) async {
|
||||
this.pointAnnotationManager = pointAnnotationManager;
|
||||
|
||||
createPoints() {
|
||||
var options = <mapBox.PointAnnotationOptions>[];
|
||||
pointsToShow!.forEach((point) {
|
||||
var textSansHTML = parse(point.title!.firstWhere((translation) => translation.language == widget.language).value);
|
||||
@ -72,35 +67,6 @@ class _MapBoxViewState extends State<MapBoxView> {
|
||||
contents: point.contents
|
||||
);
|
||||
markersList.add(mapMarker);
|
||||
if (mapMarker.latitude != null && mapMarker.longitude != null) {
|
||||
/*markers.add(Marker(
|
||||
draggable: false,
|
||||
markerId: MarkerId(mapMarker.latitude! + mapMarker.longitude!),
|
||||
position: LatLng(
|
||||
double.tryParse(mapMarker.latitude!)!,
|
||||
double.tryParse(mapMarker.longitude!)!,
|
||||
),
|
||||
icon: widget.selectedMarkerIcon != null ? BitmapDescriptor.fromBytes(widget.selectedMarkerIcon!) : BitmapDescriptor.defaultMarker,
|
||||
/*icon: BitmapDescriptor.defaultMarkerWithHue(
|
||||
BitmapDescriptor.hueYellow,
|
||||
),*/
|
||||
onTap: () {
|
||||
//setState(() {
|
||||
print("coucou tapped");
|
||||
/*mapContext.setSelectedMarker(
|
||||
new MapMarker(
|
||||
title: mapMarker.title,
|
||||
contents: mapMarker.contents,
|
||||
description: mapMarker.description,
|
||||
longitude: mapMarker.longitude,
|
||||
latitude: mapMarker.latitude,
|
||||
)
|
||||
);*/
|
||||
//});
|
||||
},
|
||||
infoWindow: InfoWindow.noText));*/
|
||||
}
|
||||
print("ADD POINT TO MAPPPPPPPPPPPP");
|
||||
print(widget.selectedMarkerIcon);
|
||||
options.add(mapBox.PointAnnotationOptions(
|
||||
geometry: mapBox.Point(
|
||||
@ -114,30 +80,23 @@ class _MapBoxViewState extends State<MapBoxView> {
|
||||
iconOffset: [0.0, 0.0],
|
||||
symbolSortKey: 10,
|
||||
iconColor: 0,
|
||||
iconImage: widget.selectedMarkerIcon == null ? "car-15": null,
|
||||
iconImage: null,
|
||||
image: widget.selectedMarkerIcon, //widget.selectedMarkerIcon,
|
||||
)); // ,
|
||||
});
|
||||
/*options.add(mapBox.PointAnnotationOptions(
|
||||
geometry: mapBox.Point(
|
||||
coordinates: mapBox.Position(
|
||||
0.381457,
|
||||
6.687337,
|
||||
)).toJson(), image: widget.selectedMarkerIcon));*/
|
||||
print(options.length);
|
||||
pointAnnotationManager.createMulti(options);
|
||||
|
||||
/*var carOptions = <mapBox.PointAnnotationOptions>[];
|
||||
for (var i = 0; i < 20; i++) {
|
||||
carOptions.add(mapBox.PointAnnotationOptions(
|
||||
geometry: mapBox.Point(
|
||||
coordinates: mapBox.Position(
|
||||
double.tryParse(mapMarker.longitude!)!,
|
||||
double.tryParse(mapMarker.latitude!)!,
|
||||
)).toJson(), iconImage: "car-15"));
|
||||
}*/
|
||||
//pointAnnotationManager.createMulti(carOptions);
|
||||
return options;
|
||||
}
|
||||
|
||||
_onMapCreated(mapBox.MapboxMap mapboxMap, MapContext mapContext) {
|
||||
this.mapboxMap = mapboxMap;
|
||||
|
||||
mapboxMap.annotations.createPointAnnotationManager().then((pointAnnotationManager) async {
|
||||
this.pointAnnotationManager = pointAnnotationManager;
|
||||
pointAnnotationManager.createMulti(createPoints());
|
||||
pointAnnotationManager.addOnPointAnnotationClickListener(AnnotationClickListener(mapContext: mapContext, markersList: markersList));
|
||||
init = true;
|
||||
});
|
||||
}
|
||||
|
||||
@ -148,50 +107,6 @@ class _MapBoxViewState extends State<MapBoxView> {
|
||||
List<String>? selectedCategories = [];
|
||||
bool init = false;
|
||||
|
||||
/*Set<Marker> getMarkers(language, mapContext) {
|
||||
markers = {};
|
||||
|
||||
pointsToShow!.forEach((point) {
|
||||
var textSansHTML = parse(point.title!.firstWhere((translation) => translation.language == language).value);
|
||||
var mapMarker = new MapMarker(
|
||||
id: point.id,
|
||||
title: parse(textSansHTML.body!.text).documentElement!.text,
|
||||
description: point.description!.firstWhere((translation) => translation.language == language).value,
|
||||
longitude: point.longitude,
|
||||
latitude: point.latitude,
|
||||
contents: point.contents
|
||||
);
|
||||
if (mapMarker.latitude != null && mapMarker.longitude != null) {
|
||||
markers.add(Marker(
|
||||
draggable: false,
|
||||
markerId: MarkerId(mapMarker.latitude! + mapMarker.longitude!),
|
||||
position: LatLng(
|
||||
double.tryParse(mapMarker.latitude!)!,
|
||||
double.tryParse(mapMarker.longitude!)!,
|
||||
),
|
||||
icon: widget.selectedMarkerIcon != null ? BitmapDescriptor.fromBytes(widget.selectedMarkerIcon!) : BitmapDescriptor.defaultMarker,
|
||||
/*icon: BitmapDescriptor.defaultMarkerWithHue(
|
||||
BitmapDescriptor.hueYellow,
|
||||
),*/
|
||||
onTap: () {
|
||||
//setState(() {
|
||||
mapContext.setSelectedMarker(
|
||||
new MapMarker(
|
||||
title: mapMarker.title,
|
||||
contents: mapMarker.contents,
|
||||
description: mapMarker.description,
|
||||
longitude: mapMarker.longitude,
|
||||
latitude: mapMarker.latitude,
|
||||
)
|
||||
);
|
||||
//});
|
||||
},
|
||||
infoWindow: InfoWindow.noText));
|
||||
}
|
||||
});
|
||||
return markers;
|
||||
}*/
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
pointsToShow = widget.mapDTO!.points;
|
||||
@ -210,49 +125,38 @@ class _MapBoxViewState extends State<MapBoxView> {
|
||||
final mapContext = Provider.of<MapContext>(context);
|
||||
Size size = MediaQuery.of(context).size;
|
||||
|
||||
if(!init) {
|
||||
print("getmarkers in build");
|
||||
//getMarkers(widget.language, mapContext);
|
||||
init = true;
|
||||
}
|
||||
//MapTypeApp? mapTypeApp = MapTypeApp.fromJson(widget.mapDTO!.mapType!.value);
|
||||
//print(mapTypeApp.toString());
|
||||
|
||||
MapType type = MapType.hybrid;
|
||||
//if(kIsWeb) {
|
||||
if(widget.mapDTO!.mapType != null) {
|
||||
switch(widget.mapDTO!.mapType!.value) {
|
||||
case 0:
|
||||
type = MapType.none;
|
||||
var type = mapBox.MapboxStyles.STANDARD;
|
||||
if(widget.mapDTO!.mapTypeMapbox != null) {
|
||||
switch(widget.mapDTO!.mapTypeMapbox!) {
|
||||
case MapTypeMapBox.standard:
|
||||
type = mapBox.MapboxStyles.STANDARD;
|
||||
break;
|
||||
case 1:
|
||||
type = MapType.normal;
|
||||
case MapTypeMapBox.streets:
|
||||
type = mapBox.MapboxStyles.MAPBOX_STREETS;
|
||||
break;
|
||||
case 2:
|
||||
type = MapType.satellite;
|
||||
case MapTypeMapBox.outdoors:
|
||||
type = mapBox.MapboxStyles.OUTDOORS;
|
||||
break;
|
||||
case 3:
|
||||
type = MapType.terrain;
|
||||
case MapTypeMapBox.light:
|
||||
type = mapBox.MapboxStyles.LIGHT;
|
||||
break;
|
||||
case 4:
|
||||
type = MapType.hybrid;
|
||||
case MapTypeMapBox.dark:
|
||||
type = mapBox.MapboxStyles.DARK;
|
||||
break;
|
||||
case MapTypeMapBox.satellite:
|
||||
type = mapBox.MapboxStyles.SATELLITE;
|
||||
break;
|
||||
case MapTypeMapBox.satellite_streets:
|
||||
type = mapBox.MapboxStyles.SATELLITE_STREETS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*} else {
|
||||
print("is OTHEER");
|
||||
type = EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString()) != null ? EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString())! : MapType.hybrid;
|
||||
}*/
|
||||
|
||||
|
||||
//MapType type = EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString()) != null ? EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString())! : MapType.hybrid;
|
||||
return Stack(
|
||||
children: [
|
||||
Center(
|
||||
child: mapBox.MapWidget(
|
||||
key: ValueKey("mapWidget"),
|
||||
styleUri: mapBox.MapboxStyles.STANDARD, // TODO update // widget.mapDTO!.mapType != null ? EnumToString.fromString(MapType.values, widget.mapDTO!.mapType.toString())!: MapType.hybrid,
|
||||
key: ValueKey("mapBoxWidget"),
|
||||
styleUri: type,
|
||||
onMapCreated: (maBoxMap) {
|
||||
_onMapCreated(maBoxMap, mapContext);
|
||||
},
|
||||
@ -285,6 +189,7 @@ class _MapBoxViewState extends State<MapBoxView> {
|
||||
pointsToShow = widget.mapDTO!.points!.where((point) => tempOutput.any((tps) => point.categorie?.label?.firstWhere((lab) => lab.language == widget.language).value == tps) || point.categorie == null).toList();
|
||||
//markers = getMarkers(widget.language, mapContext);
|
||||
pointAnnotationManager!.deleteAll();
|
||||
pointAnnotationManager!.createMulti(createPoints());
|
||||
mapContext.notifyListeners();
|
||||
});
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import 'package:tablet_app/Components/loading_common.dart';
|
||||
import 'package:tablet_app/Models/map-marker.dart';
|
||||
import 'dart:ui' as ui;
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:tablet_app/Screens/Map/map_box_view.dart';
|
||||
import 'package:tablet_app/Screens/Map/marker_view.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
@ -19,7 +20,7 @@ import '../../app_context.dart';
|
||||
import 'google_map_view.dart';
|
||||
import 'package:image/image.dart' as IMG;
|
||||
|
||||
Set<Marker> markers = {};
|
||||
//Set<Marker> markers = {};
|
||||
List<MapMarker> markersList = [];
|
||||
|
||||
class MapViewWidget extends StatefulWidget {
|
||||
@ -76,7 +77,17 @@ class _MapViewWidget extends State<MapViewWidget> {
|
||||
print("snapshot");
|
||||
print(snapshot.data);
|
||||
print(selectedMarkerIcon);
|
||||
|
||||
switch(mapDTO!.mapProvider) {
|
||||
case MapProvider.Google:
|
||||
return GoogleMapView(language: appContext.getContext().language, mapDTO: mapDTO, selectedMarkerIcon: selectedMarkerIcon);
|
||||
case MapProvider.MapBox:
|
||||
return MapBoxView(language: appContext.getContext().language, mapDTO: mapDTO, selectedMarkerIcon: selectedMarkerIcon);
|
||||
default:
|
||||
// By default google
|
||||
return GoogleMapView(language: appContext.getContext().language, mapDTO: mapDTO, selectedMarkerIcon: selectedMarkerIcon);
|
||||
}
|
||||
|
||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||
return Text("No data");
|
||||
} else {
|
||||
@ -107,6 +118,10 @@ class _MapViewWidget extends State<MapViewWidget> {
|
||||
final ByteData imageData = await NetworkAssetBundle(Uri.parse(source)).load("");
|
||||
selectedMarkerIcon = await getBytesFromAsset(imageData, 50);
|
||||
}
|
||||
} else {
|
||||
// default icon
|
||||
final ByteData bytes = await rootBundle.load('assets/icons/marker.png');
|
||||
selectedMarkerIcon = await getBytesFromAsset(bytes, 25);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
66
lib/Screens/PDF/pdf_filter.dart
Normal file
66
lib/Screens/PDF/pdf_filter.dart
Normal file
@ -0,0 +1,66 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
import 'package:manager_api/api.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tablet_app/Models/tabletContext.dart';
|
||||
import 'package:tablet_app/app_context.dart';
|
||||
import 'package:tablet_app/constants.dart';
|
||||
|
||||
class PdfFilter extends StatefulWidget {
|
||||
final List<PDFFileDTO> pdfsList;
|
||||
final Function(int?) onPDFSelected;
|
||||
|
||||
PdfFilter({required this.pdfsList, required this.onPDFSelected});
|
||||
|
||||
@override
|
||||
_PdfFilterState createState() => _PdfFilterState();
|
||||
}
|
||||
|
||||
class _PdfFilterState extends State<PdfFilter> {
|
||||
int _selectedOrderPdf = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appContext = Provider.of<AppContext>(context);
|
||||
TabletAppContext tabletAppContext = appContext.getContext();
|
||||
var currentLanguage = tabletAppContext.language;
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: widget.pdfsList.length,
|
||||
itemBuilder: (context, index) {
|
||||
if (widget.pdfsList.isNotEmpty) {
|
||||
return ListTile(
|
||||
title: HtmlWidget(
|
||||
'${widget.pdfsList[index].pdfFilesAndTitles!.firstWhere((pfat) => pfat.language == currentLanguage).value}',
|
||||
textStyle: TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: _selectedOrderPdf == widget.pdfsList[index].order ? FontWeight.bold : FontWeight.normal,
|
||||
color: _selectedOrderPdf == widget.pdfsList[index].order ? kTestSecondColor : null,
|
||||
),
|
||||
),
|
||||
/*Text(
|
||||
'${widget.pdfsList[index].pdfFilesAndTitles!.firstWhere((pfat) => pfat.language == currentLanguage).value}',
|
||||
style: TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: _selectedOrderPdf == widget.pdfsList[index].order ? FontWeight.bold : FontWeight.normal,
|
||||
color: _selectedOrderPdf == widget.pdfsList[index].order ? kTestSecondColor : null,
|
||||
),
|
||||
),*/
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selectedOrderPdf = widget.pdfsList[index].order!;
|
||||
});
|
||||
widget.onPDFSelected(_selectedOrderPdf);
|
||||
},
|
||||
tileColor: _selectedOrderPdf == widget.pdfsList[index].order ? kTestSecondColor : null,
|
||||
);
|
||||
} else {
|
||||
// Si nbrEvents est 0, ne retourne pas de widget
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,7 @@ import 'package:path_provider/path_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tablet_app/Components/loading_common.dart';
|
||||
import 'package:tablet_app/Models/tabletContext.dart';
|
||||
import 'package:tablet_app/Screens/PDF/pdf_filter.dart';
|
||||
import 'package:tablet_app/app_context.dart';
|
||||
import 'package:tablet_app/constants.dart';
|
||||
|
||||
@ -32,6 +33,7 @@ class _PDFViewWidget extends State<PDFViewWidget> {
|
||||
int? currentPage = 0;
|
||||
bool isReady = false;
|
||||
String errorMessage = '';
|
||||
late ValueNotifier<PDFFileDTO?> selectedPdf = ValueNotifier<PDFFileDTO?>(pdfDTO.pdfs!.first);
|
||||
ValueNotifier<Map<String, int>> currentState = ValueNotifier<Map<String, int>>({'page': 0, 'total': 1});
|
||||
|
||||
@override
|
||||
@ -50,17 +52,20 @@ class _PDFViewWidget extends State<PDFViewWidget> {
|
||||
});*/
|
||||
}
|
||||
|
||||
Future<File> createFileOfPdfUrl(TabletAppContext tabletAppContext, PdfDTO pdfDTO) async {
|
||||
Completer<File> completer = Completer();
|
||||
Future<File?> createFileOfPdfUrl(TabletAppContext tabletAppContext, PDFFileDTO pdfFileDTO) async {
|
||||
Completer<File?> completer = Completer();
|
||||
|
||||
var file = await _checkIfLocalResourceExists(tabletAppContext, pdfDTO.resourceId!);
|
||||
if(pdfFileDTO.pdfFilesAndTitles!.firstWhere((pfat) => pfat.language == tabletAppContext.language).resourceId == null) {
|
||||
completer.complete(null);
|
||||
} else {
|
||||
var file = await _checkIfLocalResourceExists(tabletAppContext, pdfFileDTO.pdfFilesAndTitles!.firstWhere((pfat) => pfat.language == tabletAppContext.language).resourceId!);
|
||||
|
||||
if(file == null) {
|
||||
print("Start download file from internet!");
|
||||
try {
|
||||
// "https://berlin2017.droidcon.cod.newthinking.net/sites/global.droidcon.cod.newthinking.net/files/media/documents/Flutter%20-%2060FPS%20UI%20of%20the%20future%20%20-%20DroidconDE%2017.pdf";
|
||||
// final url = "https://pdfkit.org/docs/guide.pdf";
|
||||
final url = pdfDTO.resourceUrl!;
|
||||
final url = pdfFileDTO.pdfFilesAndTitles!.firstWhere((pfat) => pfat.language == tabletAppContext.language).resourceUrl!;
|
||||
final filename = url.substring(url.lastIndexOf("/") + 1);
|
||||
var request = await HttpClient().getUrl(Uri.parse(url));
|
||||
var response = await request.close();
|
||||
@ -79,6 +84,7 @@ class _PDFViewWidget extends State<PDFViewWidget> {
|
||||
print("FOUND FILE PDF");
|
||||
completer.complete(file);
|
||||
}
|
||||
}
|
||||
|
||||
return completer.future;
|
||||
}
|
||||
@ -94,15 +100,49 @@ class _PDFViewWidget extends State<PDFViewWidget> {
|
||||
final appContext = Provider.of<AppContext>(context);
|
||||
TabletAppContext tabletAppContext = appContext.getContext();
|
||||
|
||||
return pdfDTO.resourceUrl != null && pdfDTO.resourceUrl!.length > 0 ?
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(12.5),
|
||||
child: FutureBuilder(
|
||||
future: createFileOfPdfUrl(tabletAppContext, pdfDTO),
|
||||
pdfDTO.pdfs!.sort((a, b) => a.order!.compareTo(b.order!));
|
||||
|
||||
return pdfDTO.pdfs != null && pdfDTO.pdfs!.length > 0 ?
|
||||
Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: kBackgroundColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(30.0),
|
||||
bottomLeft: Radius.circular(30.0),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: PdfFilter(
|
||||
pdfsList: pdfDTO.pdfs!,
|
||||
onPDFSelected: (selectedOrder) {
|
||||
selectedPdf.value = pdfDTO.pdfs!.firstWhere((pdf) => pdf.order == selectedOrder);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: ValueListenableBuilder<PDFFileDTO?>(
|
||||
valueListenable: selectedPdf,
|
||||
builder: (context, value, _) {
|
||||
return FutureBuilder(
|
||||
future: createFileOfPdfUrl(tabletAppContext, value!),
|
||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||
print("snapshot.data");
|
||||
print(snapshot.data);
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if(snapshot.data == null) {
|
||||
return Center(child: Text("Aucun fichier à afficher"));
|
||||
} else {
|
||||
return Stack(
|
||||
children: [
|
||||
PDFView(
|
||||
@ -142,15 +182,22 @@ class _PDFViewWidget extends State<PDFViewWidget> {
|
||||
valueListenable: currentState,
|
||||
builder: (context, value, _) {
|
||||
return Container(
|
||||
//color: Colors.blueAccent,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(30.0)),
|
||||
color: kTestSecondColor
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text("${value["page"]!+1}/${value["total"]!}",
|
||||
style: TextStyle(color: Colors.black, fontSize: 30))
|
||||
style: TextStyle(color: Colors.white, fontSize: 20)),
|
||||
)
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Center(
|
||||
child: Container(
|
||||
@ -159,9 +206,15 @@ class _PDFViewWidget extends State<PDFViewWidget> {
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
) :
|
||||
Center(child: Text("Le PDF ne peut pas être affiché, il n'existe pas", style: TextStyle(fontSize: kNoneInfoOrIncorrect)));
|
||||
Center(child: Text("Aucun pdf à afficher", style: TextStyle(fontSize: kNoneInfoOrIncorrect)));
|
||||
}
|
||||
} //_webView
|
||||
|
||||
|
||||
@ -2099,7 +2099,17 @@ components:
|
||||
type: integer
|
||||
format: int32
|
||||
mapType:
|
||||
$ref: '#/components/schemas/MapTypeApp'
|
||||
nullable: true
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/MapTypeApp'
|
||||
mapTypeMapbox:
|
||||
nullable: true
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/MapTypeMapBox'
|
||||
mapProvider:
|
||||
nullable: true
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/MapProvider'
|
||||
points:
|
||||
type: array
|
||||
nullable: true
|
||||
@ -2136,6 +2146,43 @@ components:
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
MapTypeMapBox:
|
||||
type: integer
|
||||
description: |-
|
||||
0 = standard
|
||||
1 = streets
|
||||
2 = outdoors
|
||||
3 = light
|
||||
4 = dark
|
||||
5 = satellite
|
||||
6 = satellite_streets
|
||||
x-enumNames:
|
||||
- standard
|
||||
- streets
|
||||
- outdoors
|
||||
- light
|
||||
- dark
|
||||
- satellite
|
||||
- satellite_streets
|
||||
enum:
|
||||
- 0
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- 4
|
||||
- 5
|
||||
- 6
|
||||
MapProvider:
|
||||
type: integer
|
||||
description: |-
|
||||
0 = Google
|
||||
1 = MapBox
|
||||
x-enumNames:
|
||||
- Google
|
||||
- MapBox
|
||||
enum:
|
||||
- 0
|
||||
- 1
|
||||
GeoPointDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
@ -2143,6 +2190,7 @@ components:
|
||||
id:
|
||||
type: integer
|
||||
format: int32
|
||||
nullable: true
|
||||
title:
|
||||
type: array
|
||||
nullable: true
|
||||
@ -2313,7 +2361,9 @@ components:
|
||||
type: string
|
||||
nullable: true
|
||||
imageBackgroundResourceType:
|
||||
$ref: '#/components/schemas/ResourceType'
|
||||
nullable: true
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/ResourceType'
|
||||
imageBackgroundResourceUrl:
|
||||
type: string
|
||||
nullable: true
|
||||
@ -2390,11 +2440,23 @@ components:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
resourceId:
|
||||
type: string
|
||||
pdfs:
|
||||
type: array
|
||||
nullable: true
|
||||
resourceUrl:
|
||||
type: string
|
||||
items:
|
||||
$ref: '#/components/schemas/PDFFileDTO'
|
||||
PDFFileDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
pdfFilesAndTitles:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/TranslationAndResourceDTO'
|
||||
order:
|
||||
type: integer
|
||||
format: int32
|
||||
nullable: true
|
||||
PuzzleDTO:
|
||||
type: object
|
||||
@ -2429,6 +2491,10 @@ components:
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/TranslationDTO'
|
||||
mapProvider:
|
||||
nullable: true
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/MapProvider'
|
||||
User:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
|
||||
0
macos/Flutter/ephemeral/flutter_export_environment.sh
Executable file → Normal file
0
macos/Flutter/ephemeral/flutter_export_environment.sh
Executable file → Normal file
@ -24,8 +24,14 @@ doc/InstanceDTO.md
|
||||
doc/LevelDTO.md
|
||||
doc/LoginDTO.md
|
||||
doc/MapDTO.md
|
||||
doc/MapDTOMapProvider.md
|
||||
doc/MapDTOMapType.md
|
||||
doc/MapDTOMapTypeMapbox.md
|
||||
doc/MapProvider.md
|
||||
doc/MapTypeApp.md
|
||||
doc/MapTypeMapBox.md
|
||||
doc/MenuDTO.md
|
||||
doc/PDFFileDTO.md
|
||||
doc/PdfDTO.md
|
||||
doc/PlayerMessageDTO.md
|
||||
doc/PuzzleDTO.md
|
||||
@ -84,9 +90,15 @@ lib/model/instance_dto.dart
|
||||
lib/model/level_dto.dart
|
||||
lib/model/login_dto.dart
|
||||
lib/model/map_dto.dart
|
||||
lib/model/map_dto_map_provider.dart
|
||||
lib/model/map_dto_map_type.dart
|
||||
lib/model/map_dto_map_type_mapbox.dart
|
||||
lib/model/map_provider.dart
|
||||
lib/model/map_type_app.dart
|
||||
lib/model/map_type_map_box.dart
|
||||
lib/model/menu_dto.dart
|
||||
lib/model/pdf_dto.dart
|
||||
lib/model/pdf_file_dto.dart
|
||||
lib/model/player_message_dto.dart
|
||||
lib/model/puzzle_dto.dart
|
||||
lib/model/puzzle_dto_image.dart
|
||||
@ -107,3 +119,4 @@ lib/model/user_detail_dto.dart
|
||||
lib/model/video_dto.dart
|
||||
lib/model/web_dto.dart
|
||||
pubspec.yaml
|
||||
test/pdf_file_dto_test.dart
|
||||
|
||||
@ -60,7 +60,7 @@ try {
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *https://api.myinfomate.be*
|
||||
All URIs are relative to *https://localhost:5001*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
@ -141,8 +141,14 @@ Class | Method | HTTP request | Description
|
||||
- [LevelDTO](doc\/LevelDTO.md)
|
||||
- [LoginDTO](doc\/LoginDTO.md)
|
||||
- [MapDTO](doc\/MapDTO.md)
|
||||
- [MapDTOMapProvider](doc\/MapDTOMapProvider.md)
|
||||
- [MapDTOMapType](doc\/MapDTOMapType.md)
|
||||
- [MapDTOMapTypeMapbox](doc\/MapDTOMapTypeMapbox.md)
|
||||
- [MapProvider](doc\/MapProvider.md)
|
||||
- [MapTypeApp](doc\/MapTypeApp.md)
|
||||
- [MapTypeMapBox](doc\/MapTypeMapBox.md)
|
||||
- [MenuDTO](doc\/MenuDTO.md)
|
||||
- [PDFFileDTO](doc\/PDFFileDTO.md)
|
||||
- [PdfDTO](doc\/PdfDTO.md)
|
||||
- [PlayerMessageDTO](doc\/PlayerMessageDTO.md)
|
||||
- [PuzzleDTO](doc\/PuzzleDTO.md)
|
||||
|
||||
@ -9,6 +9,7 @@ import 'package:manager_api/api.dart';
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**resourceIds** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||
**mapProvider** | [**MapDTOMapProvider**](MapDTOMapProvider.md) | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@ -9,7 +9,9 @@ import 'package:manager_api/api.dart';
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**zoom** | **int** | | [optional]
|
||||
**mapType** | [**MapTypeApp**](MapTypeApp.md) | | [optional]
|
||||
**mapType** | [**MapDTOMapType**](MapDTOMapType.md) | | [optional]
|
||||
**mapTypeMapbox** | [**MapDTOMapTypeMapbox**](MapDTOMapTypeMapbox.md) | | [optional]
|
||||
**mapProvider** | [**MapDTOMapProvider**](MapDTOMapProvider.md) | | [optional]
|
||||
**points** | [**List<GeoPointDTO>**](GeoPointDTO.md) | | [optional] [default to const []]
|
||||
**iconResourceId** | **String** | | [optional]
|
||||
**iconSource** | **String** | | [optional]
|
||||
|
||||
14
manager_api/doc/MapDTOMapProvider.md
Normal file
14
manager_api/doc/MapDTOMapProvider.md
Normal file
@ -0,0 +1,14 @@
|
||||
# manager_api.model.MapDTOMapProvider
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:manager_api/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
14
manager_api/doc/MapDTOMapType.md
Normal file
14
manager_api/doc/MapDTOMapType.md
Normal file
@ -0,0 +1,14 @@
|
||||
# manager_api.model.MapDTOMapType
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:manager_api/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
14
manager_api/doc/MapDTOMapTypeMapbox.md
Normal file
14
manager_api/doc/MapDTOMapTypeMapbox.md
Normal file
@ -0,0 +1,14 @@
|
||||
# manager_api.model.MapDTOMapTypeMapbox
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:manager_api/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
14
manager_api/doc/MapProvider.md
Normal file
14
manager_api/doc/MapProvider.md
Normal file
@ -0,0 +1,14 @@
|
||||
# manager_api.model.MapProvider
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:manager_api/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
14
manager_api/doc/MapTypeMapBox.md
Normal file
14
manager_api/doc/MapTypeMapBox.md
Normal file
@ -0,0 +1,14 @@
|
||||
# manager_api.model.MapTypeMapBox
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:manager_api/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
16
manager_api/doc/PDFFileDTO.md
Normal file
16
manager_api/doc/PDFFileDTO.md
Normal file
@ -0,0 +1,16 @@
|
||||
# manager_api.model.PDFFileDTO
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:manager_api/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**pdfFilesAndTitles** | [**List<TranslationAndResourceDTO>**](TranslationAndResourceDTO.md) | | [optional] [default to const []]
|
||||
**order** | **int** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@ -8,8 +8,7 @@ import 'package:manager_api/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**resourceId** | **String** | | [optional]
|
||||
**resourceUrl** | **String** | | [optional]
|
||||
**pdfs** | [**List<PDFFileDTO>**](PDFFileDTO.md) | | [optional] [default to const []]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
||||
@ -53,8 +53,14 @@ part 'model/instance_dto.dart';
|
||||
part 'model/level_dto.dart';
|
||||
part 'model/login_dto.dart';
|
||||
part 'model/map_dto.dart';
|
||||
part 'model/map_dto_map_provider.dart';
|
||||
part 'model/map_dto_map_type.dart';
|
||||
part 'model/map_dto_map_type_mapbox.dart';
|
||||
part 'model/map_provider.dart';
|
||||
part 'model/map_type_app.dart';
|
||||
part 'model/map_type_map_box.dart';
|
||||
part 'model/menu_dto.dart';
|
||||
part 'model/pdf_file_dto.dart';
|
||||
part 'model/pdf_dto.dart';
|
||||
part 'model/player_message_dto.dart';
|
||||
part 'model/puzzle_dto.dart';
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
part of openapi.api;
|
||||
|
||||
class ApiClient {
|
||||
ApiClient({this.basePath = 'https://api.myinfomate.be', this.authentication,});
|
||||
ApiClient({this.basePath = 'https://localhost:5001', this.authentication,});
|
||||
|
||||
final String basePath;
|
||||
final Authentication? authentication;
|
||||
@ -217,10 +217,22 @@ class ApiClient {
|
||||
return LoginDTO.fromJson(value);
|
||||
case 'MapDTO':
|
||||
return MapDTO.fromJson(value);
|
||||
case 'MapDTOMapProvider':
|
||||
return MapDTOMapProvider.fromJson(value);
|
||||
case 'MapDTOMapType':
|
||||
return MapDTOMapType.fromJson(value);
|
||||
case 'MapDTOMapTypeMapbox':
|
||||
return MapDTOMapTypeMapbox.fromJson(value);
|
||||
case 'MapProvider':
|
||||
return MapProviderTypeTransformer().decode(value);
|
||||
case 'MapTypeApp':
|
||||
return MapTypeAppTypeTransformer().decode(value);
|
||||
case 'MapTypeMapBox':
|
||||
return MapTypeMapBoxTypeTransformer().decode(value);
|
||||
case 'MenuDTO':
|
||||
return MenuDTO.fromJson(value);
|
||||
case 'PDFFileDTO':
|
||||
return PDFFileDTO.fromJson(value);
|
||||
case 'PdfDTO':
|
||||
return PdfDTO.fromJson(value);
|
||||
case 'PlayerMessageDTO':
|
||||
|
||||
@ -55,9 +55,15 @@ String parameterToString(dynamic value) {
|
||||
if (value is DateTime) {
|
||||
return value.toUtc().toIso8601String();
|
||||
}
|
||||
if (value is MapProvider) {
|
||||
return MapProviderTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is MapTypeApp) {
|
||||
return MapTypeAppTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is MapTypeMapBox) {
|
||||
return MapTypeMapBoxTypeTransformer().encode(value).toString();
|
||||
}
|
||||
if (value is ResourceType) {
|
||||
return ResourceTypeTypeTransformer().encode(value).toString();
|
||||
}
|
||||
|
||||
@ -14,21 +14,26 @@ class AgendaDTO {
|
||||
/// Returns a new [AgendaDTO] instance.
|
||||
AgendaDTO({
|
||||
this.resourceIds = const [],
|
||||
this.mapProvider,
|
||||
});
|
||||
|
||||
List<TranslationDTO>? resourceIds;
|
||||
|
||||
MapProvider? mapProvider;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is AgendaDTO &&
|
||||
other.resourceIds == resourceIds;
|
||||
other.resourceIds == resourceIds &&
|
||||
other.mapProvider == mapProvider;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(resourceIds == null ? 0 : resourceIds!.hashCode);
|
||||
(resourceIds == null ? 0 : resourceIds!.hashCode) +
|
||||
(mapProvider == null ? 0 : mapProvider!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AgendaDTO[resourceIds=$resourceIds]';
|
||||
String toString() => 'AgendaDTO[resourceIds=$resourceIds, mapProvider=$mapProvider]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -37,6 +42,11 @@ class AgendaDTO {
|
||||
} else {
|
||||
json[r'resourceIds'] = null;
|
||||
}
|
||||
if (this.mapProvider != null) {
|
||||
json[r'mapProvider'] = this.mapProvider;
|
||||
} else {
|
||||
json[r'mapProvider'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -60,6 +70,7 @@ class AgendaDTO {
|
||||
|
||||
return AgendaDTO(
|
||||
resourceIds: TranslationDTO.listFromJson(json[r'resourceIds']),
|
||||
mapProvider: MapProvider.fromJson(json[r'mapProvider']),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -22,12 +22,6 @@ class GeoPointDTO {
|
||||
this.longitude,
|
||||
});
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
int? id;
|
||||
|
||||
List<TranslationDTO>? title;
|
||||
|
||||
@ -15,6 +15,8 @@ class MapDTO {
|
||||
MapDTO({
|
||||
this.zoom,
|
||||
this.mapType,
|
||||
this.mapTypeMapbox,
|
||||
this.mapProvider,
|
||||
this.points = const [],
|
||||
this.iconResourceId,
|
||||
this.iconSource,
|
||||
@ -29,14 +31,12 @@ class MapDTO {
|
||||
///
|
||||
int? zoom;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
MapTypeApp? mapType;
|
||||
|
||||
MapTypeMapBox? mapTypeMapbox;
|
||||
|
||||
MapProvider? mapProvider;
|
||||
|
||||
List<GeoPointDTO>? points;
|
||||
|
||||
String? iconResourceId;
|
||||
@ -49,6 +49,8 @@ class MapDTO {
|
||||
bool operator ==(Object other) => identical(this, other) || other is MapDTO &&
|
||||
other.zoom == zoom &&
|
||||
other.mapType == mapType &&
|
||||
other.mapTypeMapbox == mapTypeMapbox &&
|
||||
other.mapProvider == mapProvider &&
|
||||
other.points == points &&
|
||||
other.iconResourceId == iconResourceId &&
|
||||
other.iconSource == iconSource &&
|
||||
@ -59,13 +61,15 @@ class MapDTO {
|
||||
// ignore: unnecessary_parenthesis
|
||||
(zoom == null ? 0 : zoom!.hashCode) +
|
||||
(mapType == null ? 0 : mapType!.hashCode) +
|
||||
(mapTypeMapbox == null ? 0 : mapTypeMapbox!.hashCode) +
|
||||
(mapProvider == null ? 0 : mapProvider!.hashCode) +
|
||||
(points == null ? 0 : points!.hashCode) +
|
||||
(iconResourceId == null ? 0 : iconResourceId!.hashCode) +
|
||||
(iconSource == null ? 0 : iconSource!.hashCode) +
|
||||
(categories == null ? 0 : categories!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'MapDTO[zoom=$zoom, mapType=$mapType, points=$points, iconResourceId=$iconResourceId, iconSource=$iconSource, categories=$categories]';
|
||||
String toString() => 'MapDTO[zoom=$zoom, mapType=$mapType, mapTypeMapbox=$mapTypeMapbox, mapProvider=$mapProvider, points=$points, iconResourceId=$iconResourceId, iconSource=$iconSource, categories=$categories]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -79,6 +83,16 @@ class MapDTO {
|
||||
} else {
|
||||
json[r'mapType'] = null;
|
||||
}
|
||||
if (this.mapTypeMapbox != null) {
|
||||
json[r'mapTypeMapbox'] = this.mapTypeMapbox;
|
||||
} else {
|
||||
json[r'mapTypeMapbox'] = null;
|
||||
}
|
||||
if (this.mapProvider != null) {
|
||||
json[r'mapProvider'] = this.mapProvider;
|
||||
} else {
|
||||
json[r'mapProvider'] = null;
|
||||
}
|
||||
if (this.points != null) {
|
||||
json[r'points'] = this.points;
|
||||
} else {
|
||||
@ -123,6 +137,8 @@ class MapDTO {
|
||||
return MapDTO(
|
||||
zoom: mapValueOfType<int>(json, r'zoom'),
|
||||
mapType: MapTypeApp.fromJson(json[r'mapType']),
|
||||
mapTypeMapbox: MapTypeMapBox.fromJson(json[r'mapTypeMapbox']),
|
||||
mapProvider: MapProvider.fromJson(json[r'mapProvider']),
|
||||
points: GeoPointDTO.listFromJson(json[r'points']),
|
||||
iconResourceId: mapValueOfType<String>(json, r'iconResourceId'),
|
||||
iconSource: mapValueOfType<String>(json, r'iconSource'),
|
||||
|
||||
96
manager_api/lib/model/map_dto_map_provider.dart
Normal file
96
manager_api/lib/model/map_dto_map_provider.dart
Normal file
@ -0,0 +1,96 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class MapDTOMapProvider {
|
||||
/// Returns a new [MapDTOMapProvider] instance.
|
||||
MapDTOMapProvider();
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is MapDTOMapProvider;
|
||||
|
||||
@override
|
||||
String toString() => 'MapDTOMapProvider[]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [MapDTOMapProvider] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static MapDTOMapProvider? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
// Ensure that the map contains the required keys.
|
||||
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "MapDTOMapProvider[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "MapDTOMapProvider[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return MapDTOMapProvider(
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<MapDTOMapProvider> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <MapDTOMapProvider>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = MapDTOMapProvider.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, MapDTOMapProvider> mapFromJson(dynamic json) {
|
||||
final map = <String, MapDTOMapProvider>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = MapDTOMapProvider.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of MapDTOMapProvider-objects as value to a dart map
|
||||
static Map<String, List<MapDTOMapProvider>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<MapDTOMapProvider>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = MapDTOMapProvider.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
}
|
||||
|
||||
96
manager_api/lib/model/map_dto_map_type.dart
Normal file
96
manager_api/lib/model/map_dto_map_type.dart
Normal file
@ -0,0 +1,96 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class MapDTOMapType {
|
||||
/// Returns a new [MapDTOMapType] instance.
|
||||
MapDTOMapType();
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is MapDTOMapType;
|
||||
|
||||
@override
|
||||
String toString() => 'MapDTOMapType[]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [MapDTOMapType] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static MapDTOMapType? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
// Ensure that the map contains the required keys.
|
||||
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "MapDTOMapType[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "MapDTOMapType[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return MapDTOMapType(
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<MapDTOMapType> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <MapDTOMapType>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = MapDTOMapType.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, MapDTOMapType> mapFromJson(dynamic json) {
|
||||
final map = <String, MapDTOMapType>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = MapDTOMapType.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of MapDTOMapType-objects as value to a dart map
|
||||
static Map<String, List<MapDTOMapType>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<MapDTOMapType>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = MapDTOMapType.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
}
|
||||
|
||||
96
manager_api/lib/model/map_dto_map_type_mapbox.dart
Normal file
96
manager_api/lib/model/map_dto_map_type_mapbox.dart
Normal file
@ -0,0 +1,96 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class MapDTOMapTypeMapbox {
|
||||
/// Returns a new [MapDTOMapTypeMapbox] instance.
|
||||
MapDTOMapTypeMapbox();
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is MapDTOMapTypeMapbox;
|
||||
|
||||
@override
|
||||
String toString() => 'MapDTOMapTypeMapbox[]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [MapDTOMapTypeMapbox] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static MapDTOMapTypeMapbox? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
// Ensure that the map contains the required keys.
|
||||
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "MapDTOMapTypeMapbox[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "MapDTOMapTypeMapbox[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return MapDTOMapTypeMapbox(
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<MapDTOMapTypeMapbox> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <MapDTOMapTypeMapbox>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = MapDTOMapTypeMapbox.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, MapDTOMapTypeMapbox> mapFromJson(dynamic json) {
|
||||
final map = <String, MapDTOMapTypeMapbox>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = MapDTOMapTypeMapbox.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of MapDTOMapTypeMapbox-objects as value to a dart map
|
||||
static Map<String, List<MapDTOMapTypeMapbox>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<MapDTOMapTypeMapbox>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = MapDTOMapTypeMapbox.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
}
|
||||
|
||||
98
manager_api/lib/model/map_provider.dart
Normal file
98
manager_api/lib/model/map_provider.dart
Normal file
@ -0,0 +1,98 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
/// 0 = Google 1 = MapBox
|
||||
class MapProvider {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const MapProvider._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final int value;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
|
||||
int toJson() => value;
|
||||
|
||||
static const Google = MapProvider._(0);
|
||||
static const MapBox = MapProvider._(1);
|
||||
|
||||
/// List of all possible values in this [enum][MapProvider].
|
||||
static const values = <MapProvider>[
|
||||
Google,
|
||||
MapBox,
|
||||
];
|
||||
|
||||
static MapProvider? fromJson(dynamic value) => MapProviderTypeTransformer().decode(value);
|
||||
|
||||
static List<MapProvider> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <MapProvider>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = MapProvider.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [MapProvider] to int,
|
||||
/// and [decode] dynamic data back to [MapProvider].
|
||||
class MapProviderTypeTransformer {
|
||||
factory MapProviderTypeTransformer() => _instance ??= const MapProviderTypeTransformer._();
|
||||
|
||||
const MapProviderTypeTransformer._();
|
||||
|
||||
int encode(MapProvider data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a MapProvider.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
MapProvider? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
if(data.runtimeType == String) {
|
||||
switch (data.toString().toLowerCase()) {
|
||||
case r'google': return MapProvider.Google;
|
||||
case r'mapbox': return MapProvider.MapBox;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(data.runtimeType == int) {
|
||||
switch (data) {
|
||||
case 0: return MapProvider.Google;
|
||||
case 1: return MapProvider.MapBox;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [MapProviderTypeTransformer] instance.
|
||||
static MapProviderTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ class MapTypeAppTypeTransformer {
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
MapTypeApp? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
/*if (data != null) {
|
||||
switch (data.toString()) {
|
||||
case r'None': return MapTypeApp.none;
|
||||
case r'Normal': return MapTypeApp.normal;
|
||||
@ -84,7 +84,7 @@ class MapTypeAppTypeTransformer {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if (data != null) {
|
||||
if(data.runtimeType == String) {
|
||||
switch (data.toString()) {
|
||||
@ -113,7 +113,6 @@ class MapTypeAppTypeTransformer {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
119
manager_api/lib/model/map_type_map_box.dart
Normal file
119
manager_api/lib/model/map_type_map_box.dart
Normal file
@ -0,0 +1,119 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
/// 0 = standard 1 = streets 2 = outdoors 3 = light 4 = dark 5 = satellite 6 = satellite_streets
|
||||
class MapTypeMapBox {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const MapTypeMapBox._(this.value);
|
||||
|
||||
/// The underlying value of this enum member.
|
||||
final int value;
|
||||
|
||||
@override
|
||||
String toString() => value.toString();
|
||||
|
||||
int toJson() => value;
|
||||
|
||||
static const standard = MapTypeMapBox._(0);
|
||||
static const streets = MapTypeMapBox._(1);
|
||||
static const outdoors = MapTypeMapBox._(2);
|
||||
static const light = MapTypeMapBox._(3);
|
||||
static const dark = MapTypeMapBox._(4);
|
||||
static const satellite = MapTypeMapBox._(5);
|
||||
static const satellite_streets = MapTypeMapBox._(6);
|
||||
|
||||
/// List of all possible values in this [enum][MapTypeMapBox].
|
||||
static const values = <MapTypeMapBox>[
|
||||
standard,
|
||||
streets,
|
||||
outdoors,
|
||||
light,
|
||||
dark,
|
||||
satellite,
|
||||
satellite_streets,
|
||||
];
|
||||
|
||||
static MapTypeMapBox? fromJson(dynamic value) => MapTypeMapBoxTypeTransformer().decode(value);
|
||||
|
||||
static List<MapTypeMapBox> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <MapTypeMapBox>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = MapTypeMapBox.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
}
|
||||
|
||||
/// Transformation class that can [encode] an instance of [MapTypeMapBox] to int,
|
||||
/// and [decode] dynamic data back to [MapTypeMapBox].
|
||||
class MapTypeMapBoxTypeTransformer {
|
||||
factory MapTypeMapBoxTypeTransformer() => _instance ??= const MapTypeMapBoxTypeTransformer._();
|
||||
|
||||
const MapTypeMapBoxTypeTransformer._();
|
||||
|
||||
int encode(MapTypeMapBox data) => data.value;
|
||||
|
||||
/// Decodes a [dynamic value][data] to a MapTypeMapBox.
|
||||
///
|
||||
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
||||
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
||||
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
||||
///
|
||||
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
||||
/// and users are still using an old app with the old code.
|
||||
MapTypeMapBox? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
if(data.runtimeType == String) {
|
||||
switch (data.toString().toLowerCase()) {
|
||||
case r'standard': return MapTypeMapBox.standard;
|
||||
case r'streets': return MapTypeMapBox.streets;
|
||||
case r'outdoors': return MapTypeMapBox.outdoors;
|
||||
case r'light': return MapTypeMapBox.light;
|
||||
case r'dark': return MapTypeMapBox.dark;
|
||||
case r'satellite': return MapTypeMapBox.satellite;
|
||||
case r'satellite_streets': return MapTypeMapBox.satellite_streets;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(data.runtimeType == int) {
|
||||
switch (data) {
|
||||
case 0: return MapTypeMapBox.standard;
|
||||
case 1: return MapTypeMapBox.streets;
|
||||
case 2: return MapTypeMapBox.outdoors;
|
||||
case 3: return MapTypeMapBox.light;
|
||||
case 4: return MapTypeMapBox.dark;
|
||||
case 5: return MapTypeMapBox.satellite;
|
||||
case 6: return MapTypeMapBox.satellite_streets;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Singleton [MapTypeMapBoxTypeTransformer] instance.
|
||||
static MapTypeMapBoxTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
@ -13,39 +13,29 @@ part of openapi.api;
|
||||
class PdfDTO {
|
||||
/// Returns a new [PdfDTO] instance.
|
||||
PdfDTO({
|
||||
this.resourceId,
|
||||
this.resourceUrl,
|
||||
this.pdfs = const [],
|
||||
});
|
||||
|
||||
String? resourceId;
|
||||
|
||||
String? resourceUrl;
|
||||
List<PDFFileDTO>? pdfs;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is PdfDTO &&
|
||||
other.resourceId == resourceId &&
|
||||
other.resourceUrl == resourceUrl;
|
||||
other.pdfs == pdfs;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(resourceId == null ? 0 : resourceId!.hashCode) +
|
||||
(resourceUrl == null ? 0 : resourceUrl!.hashCode);
|
||||
(pdfs == null ? 0 : pdfs!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'PdfDTO[resourceId=$resourceId, resourceUrl=$resourceUrl]';
|
||||
String toString() => 'PdfDTO[pdfs=$pdfs]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.resourceId != null) {
|
||||
json[r'resourceId'] = this.resourceId;
|
||||
if (this.pdfs != null) {
|
||||
json[r'pdfs'] = this.pdfs;
|
||||
} else {
|
||||
json[r'resourceId'] = null;
|
||||
}
|
||||
if (this.resourceUrl != null) {
|
||||
json[r'resourceUrl'] = this.resourceUrl;
|
||||
} else {
|
||||
json[r'resourceUrl'] = null;
|
||||
json[r'pdfs'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
@ -69,8 +59,7 @@ class PdfDTO {
|
||||
}());
|
||||
|
||||
return PdfDTO(
|
||||
resourceId: mapValueOfType<String>(json, r'resourceId'),
|
||||
resourceUrl: mapValueOfType<String>(json, r'resourceUrl'),
|
||||
pdfs: PDFFileDTO.listFromJson(json[r'pdfs']),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
123
manager_api/lib/model/pdf_file_dto.dart
Normal file
123
manager_api/lib/model/pdf_file_dto.dart
Normal file
@ -0,0 +1,123 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
class PDFFileDTO {
|
||||
/// Returns a new [PDFFileDTO] instance.
|
||||
PDFFileDTO({
|
||||
this.pdfFilesAndTitles = const [],
|
||||
this.order,
|
||||
});
|
||||
|
||||
List<TranslationAndResourceDTO>? pdfFilesAndTitles;
|
||||
|
||||
int? order;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is PDFFileDTO &&
|
||||
other.pdfFilesAndTitles == pdfFilesAndTitles &&
|
||||
other.order == order;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(pdfFilesAndTitles == null ? 0 : pdfFilesAndTitles!.hashCode) +
|
||||
(order == null ? 0 : order!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'PDFFileDTO[pdfFilesAndTitles=$pdfFilesAndTitles, order=$order]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.pdfFilesAndTitles != null) {
|
||||
json[r'pdfFilesAndTitles'] = this.pdfFilesAndTitles;
|
||||
} else {
|
||||
json[r'pdfFilesAndTitles'] = null;
|
||||
}
|
||||
if (this.order != null) {
|
||||
json[r'order'] = this.order;
|
||||
} else {
|
||||
json[r'order'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [PDFFileDTO] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static PDFFileDTO? fromJson(dynamic value) {
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
// Ensure that the map contains the required keys.
|
||||
// Note 1: the values aren't checked for validity beyond being non-null.
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "PDFFileDTO[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "PDFFileDTO[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return PDFFileDTO(
|
||||
pdfFilesAndTitles: TranslationAndResourceDTO.listFromJson(json[r'pdfFilesAndTitles']),
|
||||
order: mapValueOfType<int>(json, r'order'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<PDFFileDTO> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <PDFFileDTO>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = PDFFileDTO.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, PDFFileDTO> mapFromJson(dynamic json) {
|
||||
final map = <String, PDFFileDTO>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = PDFFileDTO.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of PDFFileDTO-objects as value to a dart map
|
||||
static Map<String, List<PDFFileDTO>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<PDFFileDTO>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = PDFFileDTO.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
}
|
||||
|
||||
22
manager_api/test/map_dto_map_provider_test.dart
Normal file
22
manager_api/test/map_dto_map_provider_test.dart
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:manager_api/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for MapDTOMapProvider
|
||||
void main() {
|
||||
// final instance = MapDTOMapProvider();
|
||||
|
||||
group('test MapDTOMapProvider', () {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
22
manager_api/test/map_dto_map_type_mapbox_test.dart
Normal file
22
manager_api/test/map_dto_map_type_mapbox_test.dart
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:manager_api/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for MapDTOMapTypeMapbox
|
||||
void main() {
|
||||
// final instance = MapDTOMapTypeMapbox();
|
||||
|
||||
group('test MapDTOMapTypeMapbox', () {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
22
manager_api/test/map_dto_map_type_test.dart
Normal file
22
manager_api/test/map_dto_map_type_test.dart
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:manager_api/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for MapDTOMapType
|
||||
void main() {
|
||||
// final instance = MapDTOMapType();
|
||||
|
||||
group('test MapDTOMapType', () {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
21
manager_api/test/map_provider_test.dart
Normal file
21
manager_api/test/map_provider_test.dart
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:manager_api/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for MapProvider
|
||||
void main() {
|
||||
|
||||
group('test MapProvider', () {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
21
manager_api/test/map_type_map_box_test.dart
Normal file
21
manager_api/test/map_type_map_box_test.dart
Normal file
@ -0,0 +1,21 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:manager_api/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for MapTypeMapBox
|
||||
void main() {
|
||||
|
||||
group('test MapTypeMapBox', () {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
32
manager_api/test/pdf_file_dto_test.dart
Normal file
32
manager_api/test/pdf_file_dto_test.dart
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
||||
//
|
||||
// @dart=2.12
|
||||
|
||||
// ignore_for_file: unused_element, unused_import
|
||||
// ignore_for_file: always_put_required_named_parameters_first
|
||||
// ignore_for_file: constant_identifier_names
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'package:manager_api/api.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
// tests for PDFFileDTO
|
||||
void main() {
|
||||
// final instance = PDFFileDTO();
|
||||
|
||||
group('test PDFFileDTO', () {
|
||||
// List<TranslationAndResourceDTO> pdfFilesAndTitles (default value: const [])
|
||||
test('to test the property `pdfFilesAndTitles`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// int order
|
||||
test('to test the property `order`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user