Fix translation and ressource not update + PDF fileS + Agenda map provider + Map handling mapBox

This commit is contained in:
Thomas Fransolet 2024-03-12 22:58:35 +01:00
parent 5fc16ffd0c
commit 15a11b9eb7
45 changed files with 1898 additions and 6008 deletions

View File

@ -0,0 +1,147 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:manager_api_new/api.dart';
import 'package:manager_app/Components/rounded_button.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/category_list.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/PDF/pdf_list.dart';
import 'package:manager_app/constants.dart';
class PDFFileInputContainer extends StatefulWidget {
final Color color;
final String label;
List<PDFFileDTO> initialValue;
final ValueChanged<List<PDFFileDTO>> onChanged;
PDFFileInputContainer({
Key? key,
this.color = kSecond,
required this.label,
required this.initialValue,
required this.onChanged,
}) : super(key: key);
@override
_PDFFileInputContainerState createState() => _PDFFileInputContainerState();
}
class _PDFFileInputContainerState extends State<PDFFileInputContainer> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Container(
child: Row(
children: [
Align(
alignment: AlignmentDirectional.centerStart,
child: Text(widget.label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300))
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: size.width *0.15,
child: InkWell(
onTap: () {
List<PDFFileDTO> newValues = <PDFFileDTO>[];
List<PDFFileDTO> initials = widget.initialValue;
showCreateOrUpdatePdfFiles("Fichiers PDF", initials, newValues, (value) {
widget.onChanged(value);
widget.initialValue = value;
}, context);
},
child: Container(
decoration: BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.circular(50),
),
child: Padding(
padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
child: Center(
child: AutoSizeText(
"Changer",
style: TextStyle(color: kWhite),
maxLines: 2,
)
),
)
),
),
),
),
],
),
);
}
}
showCreateOrUpdatePdfFiles(String modalLabel, List<PDFFileDTO> values, List<PDFFileDTO> newValues, Function onGetResult, BuildContext context) {
showDialog(
builder: (BuildContext context) {
Size size = MediaQuery.of(context).size;
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))
),
title: Center(child: Text(modalLabel)),
content: SingleChildScrollView(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
border: Border.all(width: 0.75, color: kSecond)
),
height: size.height * 0.7,
width: size.width * 0.65,
child: PDFList(pdfs: values, onChanged: (result) {
newValues = result;
onGetResult(result);
}),
)
),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
width: 180,
height: 70,
child: RoundedButton(
text: "Annuler",
icon: Icons.undo,
color: kSecond,
press: () {
onGetResult(values);
Navigator.of(context).pop();
},
fontSize: 20,
),
),
Container(
width: 180,
height: 70,
child: RoundedButton(
text: "Valider",
icon: Icons.check,
color: kPrimaryColor,
textColor: kWhite,
press: () {
/*Function deepEq = const DeepCollectionEquality().equals;
if (!deepEq(values, newValues)) {
onGetResult(newValues);
}*/
Navigator.of(context).pop();
},
fontSize: 20,
),
),
],
),
],
);
}, context: context
);
}

View File

@ -0,0 +1,89 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/constants.dart';
class SingleSelectContainer extends StatefulWidget {
final Color? color;
final String label;
final String? initialValue;
final List<String> inputValues;
final ValueChanged<String>? onChanged;
final double fontSize;
final double fontSizeText;
const SingleSelectContainer({
Key? key,
this.color = kSecond,
required this.label,
this.initialValue = "",
required this.inputValues,
this.onChanged,
this.fontSize = 25,
this.fontSizeText = 20,
}) : super(key: key);
@override
_SingleSelectContainerState createState() => _SingleSelectContainerState();
}
class _SingleSelectContainerState extends State<SingleSelectContainer> {
String? selectedValue;
@override
void initState() {
selectedValue = widget.initialValue;
super.initState();
}
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Container(
child: Row(
children: [
Align(
alignment: AlignmentDirectional.centerStart,
child: AutoSizeText(
widget.label,
style: TextStyle(fontSize: widget.fontSize, fontWeight: FontWeight.w300),
maxLines: 2,
maxFontSize: widget.fontSize,
textAlign: TextAlign.center,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
width: size.width *0.15,
constraints: BoxConstraints(maxWidth: 175),
child: DropdownButton<String>(
value: selectedValue,
icon: const Icon(Icons.arrow_downward),
iconSize: 24,
elevation: 16,
style: TextStyle(color: widget.color!),
underline: Container(
height: 2,
color: kPrimaryColor,
),
onChanged: (String? newValue) {
setState(() {
selectedValue = newValue!;
widget.onChanged!(selectedValue!);
});
},
items: widget.inputValues.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value, style: TextStyle(fontSize: 20, fontWeight: FontWeight.w400, color: widget.color)),
);
}).toList(),
),
),
),
],
),
);
}
}

View File

@ -37,12 +37,12 @@ class _TranslationInputAndResourceContainerState extends State<TranslationInputA
controllerQuill.onTextChanged((p0) async {
var plainText = await controllerQuill.getPlainText();
if(widget.isTitle) {
if(plainText.length > 110) {
if(plainText.length > kTitleMaxLength) {
print("to much text au dessus");
controllerQuill.undo();
}
} else {
if(plainText.length > 2500) {
if(plainText.length > kDescriptionMaxLength) {
print("to much text description au dessus");
controllerQuill.undo();
}
@ -53,12 +53,12 @@ class _TranslationInputAndResourceContainerState extends State<TranslationInputA
if (!_tabController!.indexIsChanging) {
setState(() {
currentLanguage!.value = widget.newValues[_tabController!.index].language;
if(widget.resourceTypes == null) {
//if(widget.resourceTypes == null) {
print("insert try without ress");
print(widget.newValues[_tabController!.index].value!);
controllerQuill.clear();
controllerQuill.insertText(widget.newValues[_tabController!.index].value!);
}
//}
});
}
});
@ -126,7 +126,7 @@ class _TranslationInputAndResourceContainerState extends State<TranslationInputA
child: Container(
width: MediaQuery.of(context).size.width *0.7,
//color: Colors.blueAccent,
height: widget.isTitle ? MediaQuery.of(context).size.height *0.32 : MediaQuery.of(context).size.height *0.37,
height: widget.isTitle ? MediaQuery.of(context).size.height *0.34 : MediaQuery.of(context).size.height *0.37,
child: resourceTypes != null ?
Column(
children: [
@ -178,7 +178,7 @@ class _TranslationInputAndResourceContainerState extends State<TranslationInputA
label: "Ressource à afficher :",
initialValue: newValues.where((element) => element.language! == value).first.resourceId,
color: kPrimaryColor,
inResourceTypes: [ResourceType.Image, ResourceType.ImageUrl, ResourceType.Video, ResourceType.VideoUrl, ResourceType.Audio],
inResourceTypes: resourceTypes,
isLanguageTab: true,
onChanged: (ResourceDTO resource) {
setState(() {

View File

@ -36,12 +36,12 @@ class _TranslationInputContainerState extends State<TranslationInputContainer> w
controllerQuill.onTextChanged((p0) async {
var plainText = await controllerQuill.getPlainText();
if(widget.isTitle) {
if(plainText.length > 110) {
if(plainText.length > kTitleMaxLength) {
print("to much text au dessus");
controllerQuill.undo();
}
} else {
if(plainText.length > 2500) {
if(plainText.length > kDescriptionMaxLength) {
print("to much text description au dessus");
controllerQuill.undo();
}
@ -223,16 +223,6 @@ class _TranslationInputContainerState extends State<TranslationInputContainer> w
),
),
getTranslation(context, Provider.of<AppContext>(context), controllerQuill, customToolBarList, widget.isTitle, widget.resourceTypes, widget.newValues, currentLanguage!)
/*TabContainer(
radius: 0,
tabs: values.map((v) => v.language!.toUpperCase()).toList(),
children: getTranslations(context, Provider.of<AppContext>(context), controllerQuill, customToolBarList, label, isTitle, isAudio, newValues),
/*child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: getTranslations(context, Provider.of<AppContext>(context), controllerQuill, label, isTitle, isAudio, newValues),
),*/
),*/
],
),
),

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:manager_app/Components/multi_string_input_container.dart';
import 'package:manager_app/Components/resource_input_container.dart';
import 'package:manager_api_new/api.dart';
import 'package:manager_app/Components/single_select_container.dart';
import 'dart:convert';
import 'package:manager_app/constants.dart';
@ -36,7 +37,47 @@ class _AgendaConfigState extends State<AgendaConfig> {
@override
Widget build(BuildContext context) {
return MultiStringInputContainer(
Size size = MediaQuery.of(context).size;
var mapProviderIn = "";
switch(agendaDTO.mapProvider) {
case MapProvider.Google :
mapProviderIn = "Google";
break;
case MapProvider.MapBox :
mapProviderIn = "MapBox";
break;
default:
mapProviderIn = "Google";
break;
}
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: size.height * 0.3,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SingleSelectContainer(
label: "Service carte :",
color: Colors.black,
initialValue: mapProviderIn,
inputValues: map_providers,
onChanged: (String value) {
switch(value) {
case "Google":
agendaDTO.mapProvider = MapProvider.Google;
break;
case "MapBox":
agendaDTO.mapProvider = MapProvider.MapBox;
break;
}
widget.onChanged(jsonEncode(agendaDTO).toString());
}
),
MultiStringInputContainer(
label: "Fichiers json :",
resourceTypes: [ResourceType.Json, ResourceType.JsonUrl],
modalLabel: "JSON",
@ -53,6 +94,11 @@ class _AgendaConfigState extends State<AgendaConfig> {
});
},
maxLines: 1,
),
],
),
),
),
);
/*return ResourceInputContainer(
label: "Fichier JSON :",

View File

@ -4,6 +4,7 @@ import 'package:manager_app/Components/category_input_container.dart';
import 'package:manager_app/Components/fetch_section_icon.dart';
import 'package:manager_app/Components/resource_input_container.dart';
import 'package:manager_app/Components/multi_select_container.dart';
import 'package:manager_app/Components/single_select_container.dart';
import 'package:manager_app/Components/slider_input_container.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart';
import 'package:manager_app/app_context.dart';
@ -34,6 +35,7 @@ class _MapConfigState extends State<MapConfig> {
late MapDTO mapDTO;
String mapType= "hybrid";
String mapTypeMapBox= "standard";
@override
void initState() {
@ -62,6 +64,32 @@ class _MapConfigState extends State<MapConfig> {
}
}
if(mapDTO.mapTypeMapbox != null) {
switch(mapDTO.mapTypeMapbox!.value) {
case 0:
mapTypeMapBox = "standard";
break;
case 1:
mapTypeMapBox = "streets";
break;
case 2:
mapTypeMapBox = "outdoors";
break;
case 3:
mapTypeMapBox = "light";
break;
case 4:
mapTypeMapBox = "dark";
break;
case 5:
mapTypeMapBox = "satellite";
break;
case 6:
mapTypeMapBox = "satellite_streets";
break;
}
}
/*print("MAPDTO");
print(mapDTO);
print(mapDTO.mapType.toString());
@ -75,16 +103,48 @@ class _MapConfigState extends State<MapConfig> {
final appContext = Provider.of<AppContext>(context);
Size size = MediaQuery.of(context).size;
var mapProviderIn = "";
switch(mapDTO.mapProvider) {
case MapProvider.Google :
mapProviderIn = "Google";
break;
case MapProvider.MapBox :
mapProviderIn = "MapBox";
break;
default:
mapProviderIn = "Google";
break;
}
return
SingleChildScrollView(
child: Column(
children: [
Container(
height: size.height * 0.15,
height: size.height * 0.3,
width: double.infinity,
child: Row(
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
SingleSelectContainer(
label: "Service :",
color: Colors.black,
initialValue: mapProviderIn,
inputValues: map_providers,
onChanged: (String value) {
switch(value) {
case "Google":
mapDTO.mapProvider = MapProvider.Google;
break;
case "MapBox":
mapDTO.mapProvider = MapProvider.MapBox;
break;
}
widget.onChanged(jsonEncode(mapDTO).toString());
}
),
// Icon
ResourceInputContainer(
label: "Icône:",
@ -103,6 +163,12 @@ class _MapConfigState extends State<MapConfig> {
},
isSmall: true
),
]
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
if(mapDTO.mapProvider == MapProvider.Google)
// Map Type
MultiSelectContainer(
label: "Type:",
@ -117,6 +183,19 @@ class _MapConfigState extends State<MapConfig> {
widget.onChanged(jsonEncode(mapDTO).toString());
},
),
if(mapDTO.mapProvider == MapProvider.MapBox)
MultiSelectContainer(
label: "Type:",
initialValue: [mapTypeMapBox], //mapDTO.mapType.toString()
isMultiple: false,
values: map_types_mapBox,
onChanged: (value) {
var tempOutput = new List<String>.from(value);
print(value);
mapDTO.mapTypeMapbox = MapTypeMapBox.fromJson(tempOutput[0]);
widget.onChanged(jsonEncode(mapDTO).toString());
},
),
// Zoom
SliderInputContainer(
label: "Zoom:",
@ -145,6 +224,8 @@ class _MapConfigState extends State<MapConfig> {
)
],
),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),

View File

@ -1,9 +1,12 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/pdf_file_input_container.dart';
import 'package:manager_app/Components/resource_input_container.dart';
import 'package:manager_api_new/api.dart';
import 'dart:convert';
import 'package:manager_app/constants.dart';
class PDFConfig extends StatefulWidget {
final String? color;
final String? label;
@ -34,15 +37,20 @@ class _PDFConfigState extends State<PDFConfig> {
@override
Widget build(BuildContext context) {
return Center(
child: ResourceInputContainer(
label: "Fichier PDF :",
inResourceTypes: [ResourceType.Pdf],
initialValue: pdfDTO.resourceId == null ? '': pdfDTO.resourceId,
onChanged: (ResourceDTO resourceDTO) {
pdfDTO.resourceUrl = resourceDTO.url;
pdfDTO.resourceId = resourceDTO.id;
child: Container(
height: 70,
width: 425,
child: PDFFileInputContainer(
label: "Fichiers PDF :",
initialValue: pdfDTO.pdfs != null ? pdfDTO.pdfs! : [],
color: kPrimaryColor,
onChanged: (List<PDFFileDTO>? value) {
if(value != null) {
pdfDTO.pdfs = value;
widget.onChanged(jsonEncode(pdfDTO).toString());
}
},
),
),
);
}

View File

@ -0,0 +1,155 @@
import 'dart:convert';
import 'package:manager_app/Components/multi_string_input_and_resource_container.dart';
import 'package:manager_app/Components/resource_input_container.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/multi_string_input_container.dart';
import 'package:manager_app/Components/rounded_button.dart';
import 'package:manager_app/Models/managerContext.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:manager_api_new/api.dart';
Future<PDFFileDTO?> showNewOrUpdatePDFFile(PDFFileDTO? inputPdfFile, AppContext appContext, BuildContext context, String text) async {
PDFFileDTO pdfFileDTO = new PDFFileDTO();
if (inputPdfFile != null) {
pdfFileDTO = inputPdfFile;
} else {
pdfFileDTO.pdfFilesAndTitles = <TranslationAndResourceDTO>[];
ManagerAppContext managerAppContext = appContext.getContext();
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
var translationMessageDTO = new TranslationAndResourceDTO();
translationMessageDTO.language = element;
translationMessageDTO.value = "";
translationMessageDTO.resourceId = null;
pdfFileDTO.pdfFilesAndTitles!.add(translationMessageDTO);
});
}
List<TranslationDTO> newValues = <TranslationDTO>[];
List<TranslationDTO> initials = [];
languages.forEach((value) {
if(initials.map((iv) => iv.language).contains(value)) {
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!);
} else {
// New language
newValues.add(TranslationDTO(language: value, value: ""));
}
});
Size size = MediaQuery.of(context).size;
var result = await showDialog(
builder: (BuildContext dialogContext) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))
),
content: Container(
width: size.width *0.5,
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(text, style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Container(
height: size.height * 0.2,
constraints: BoxConstraints(minHeight: 50, maxHeight: 80),
child: MultiStringInputAndResourceContainer(
label: "Fichier et titre pdf :",
modalLabel: "Fichier et titre pdf",
fontSize: 20,
color: kPrimaryColor,
initialValue: pdfFileDTO.pdfFilesAndTitles != null ? pdfFileDTO.pdfFilesAndTitles! : [],
resourceTypes: [ResourceType.Pdf],
onGetResult: (value) {
if (pdfFileDTO.pdfFilesAndTitles != value) {
print("get resut hereeee");
print(value);
pdfFileDTO.pdfFilesAndTitles = value;
}
},
maxLines: 1,
isTitle: true
),
),
/*Container(
height: size.height * 0.2,
constraints: BoxConstraints(minHeight: 50, maxHeight: 80),
child: ResourceInputContainer(
label: "Icône catégorie :",
initialValue: categorieDTO.iconResourceId,
color: kPrimaryColor,
onChanged: (ResourceDTO resource) {
if(resource.id == null) {
categorieDTO.iconResourceId = null;
categorieDTO.iconUrl = null;
} else {
categorieDTO.iconResourceId = resource.id;
categorieDTO.iconUrl = resource.url;
print("Icône catégorieIcône catégorie");
print(categorieDTO);
}
},
isSmall: true
),
),*/
],
),
],
),
),
),
actions: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: 175,
height: 70,
child: RoundedButton(
text: "Annuler",
icon: Icons.undo,
color: kSecond,
press: () {
Navigator.pop(dialogContext);
},
fontSize: 20,
),
),
),
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: inputPdfFile != null ? 220: 150,
height: 70,
child: RoundedButton(
text: inputPdfFile != null ? "Sauvegarder" : "Créer",
icon: Icons.check,
color: kPrimaryColor,
textColor: kWhite,
press: () {
if(pdfFileDTO.pdfFilesAndTitles != null && pdfFileDTO.pdfFilesAndTitles!.isNotEmpty)
{
Navigator.pop(dialogContext, pdfFileDTO);
}
},
fontSize: 20,
),
),
),
],
),
],
), context: context
);
return result;
}

View File

@ -0,0 +1,230 @@
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/new_update_categorie.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/PDF/new_update_pdfFile.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:manager_api_new/api.dart';
import 'package:provider/provider.dart';
class PDFList extends StatefulWidget {
final List<PDFFileDTO> pdfs;
final ValueChanged<List<PDFFileDTO>> onChanged;
const PDFList({
Key? key,
required this.pdfs,
required this.onChanged,
}) : super(key: key);
@override
_PDFListState createState() => _PDFListState();
}
class _PDFListState extends State<PDFList> {
late List<PDFFileDTO> pdfsMiddle;
@override
void initState() {
super.initState();
pdfsMiddle = new List<PDFFileDTO>.from(widget.pdfs);
pdfsMiddle.sort((a, b) => a.order!.compareTo(b.order!));
}
void _resetOrder() {
setState(
() {
var i = 0;
pdfsMiddle.forEach((pdfMiddle) {
pdfMiddle.order = i;
i++;
});
widget.onChanged(pdfsMiddle);
},
);
}
void _onReorder(int oldIndex, int newIndex) {
setState(
() {
if (newIndex > oldIndex) {
newIndex -= 1;
}
final PDFFileDTO item = pdfsMiddle.removeAt(oldIndex);
pdfsMiddle.insert(newIndex, item);
var i = 0;
pdfsMiddle.forEach((category) {
category.order = i;
i++;
});
widget.onChanged(pdfsMiddle);
},
);
}
@override
Widget build(BuildContext context) {
final appContext = Provider.of<AppContext>(context);
Size size = MediaQuery.of(context).size;
return Stack(
children: [
Padding(
padding: const EdgeInsets.only(left: 15.0, right: 15.0, bottom: 15.0, top: 32.5),
child: ReorderableListView.builder(
shrinkWrap: true,
padding: const EdgeInsets.only(right: 125),
itemBuilder: (BuildContext context, int index) {
return Container(
key: ValueKey(index),
decoration: boxDecoration(),
padding: const EdgeInsets.all(2),
margin: EdgeInsets.symmetric(vertical: 3, horizontal: 3),
child: getElement(index, pdfsMiddle[index], size, appContext),
);
},
itemCount: pdfsMiddle.length,
onReorder: _onReorder
),
),
Positioned(
top: 10,
right: 10,
child: InkWell(
onTap: () async {
PDFFileDTO newPdfFile = PDFFileDTO(order: null);
var result = await showNewOrUpdatePDFFile(newPdfFile, appContext, context, "Création PDF");
if (result != null)
{
setState(() {
result.order = pdfsMiddle.length;
pdfsMiddle.add(result);
widget.onChanged(pdfsMiddle);
});
}
},
child: Container(
height: MediaQuery.of(context).size.width * 0.04,
width: MediaQuery.of(context).size.width * 0.04,
child: Icon(
Icons.add,
color: kTextLightColor,
size: 30.0,
),
decoration: BoxDecoration(
color: kSuccess,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(20.0),
boxShadow: [
BoxShadow(
color: kSecond,
spreadRadius: 0.5,
blurRadius: 5,
offset: Offset(0, 1.5), // changes position of shadow
),
],
),
),
),
)
],
);
}
getElement(int index, PDFFileDTO pdfFileDTO, Size size, AppContext appContext) {
return Stack(
children: [
Container(
width: size.width *0.8,
height: 50,
child: Row(
children: [
Center(
child: Padding(
padding: const EdgeInsets.all(2.0),
child: HtmlWidget(
pdfFileDTO.pdfFilesAndTitles == null ? "" : pdfFileDTO.pdfFilesAndTitles![0].value!,
//textAlign: TextAlign.left,
textStyle: TextStyle(fontSize: 15)
),
),
),
],
),
),
Positioned(
right: 35,
bottom: 3,
child: Row(
children: [
Tooltip(
message: "Modifier",
child: InkWell(
onTap: () async {
var result = await showNewOrUpdatePDFFile(pdfFileDTO, appContext, context, "Modification pdf");
if (result != null)
{
setState(() {
print("RESUUULT MODIFYY ");
pdfFileDTO = result;
pdfsMiddle[pdfFileDTO.order!] = pdfFileDTO;
widget.onChanged(pdfsMiddle);
});
}
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.edit,
color: kPrimaryColor,
size: 25.0,
),
)
),
),
Tooltip(
message: "Supprimer",
child: InkWell(
onTap: () {
setState(() {
pdfsMiddle.removeAt(pdfFileDTO.order!);
_resetOrder();
widget.onChanged(pdfsMiddle);
});
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.delete,
color: kError,
size: 25.0,
),
)
),
),
],
)
),
],
);
}
}
boxDecoration() {
return BoxDecoration(
color: kBackgroundColor,
shape: BoxShape.rectangle,
border: Border.all(width: 1.5, color: kSecond),
borderRadius: BorderRadius.circular(10.0),
boxShadow: [
BoxShadow(
color: kSecond,
spreadRadius: 0.5,
blurRadius: 5,
offset: Offset(0, 1.5), // changes position of shadow
),
],
);
}

View File

@ -454,7 +454,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
initialValue: sectionDTO.data!,
onChanged: (String data) {
sectionDTO.data = data;
save(false, sectionDTO, appContext);
//save(false, sectionDTO, appContext);
},
);
case SectionType.Puzzle:

View File

@ -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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,12 @@ const kSuccess = Color(0xFF8bc34a);
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz", "Article", "PDF", "Puzzle", "Agenda"];
const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"];
const List<String> languages = ["FR", "NL", "EN", "DE", "IT", "ES", "CN", "PL", "AR", "UK"];
const List<String> map_types_mapBox = ["standard", "streets", "outdoors", "light", "dark", "satellite", "satellite_streets"];
const List<String> map_providers = ["Google", "MapBox"];
const kTitleMaxLength = 110;
const kDescriptionMaxLength = 2500;
List<ResourceTypeModel> resource_types = [
ResourceTypeModel(label: "Image", type: ResourceType.Image),
ResourceTypeModel(label: "Image url", type: ResourceType.ImageUrl),

View 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

View File

@ -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)

View File

@ -9,6 +9,7 @@ import 'package:manager_api_new/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)

View File

@ -9,7 +9,9 @@ import 'package:manager_api_new/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]

View File

@ -0,0 +1,14 @@
# manager_api_new.model.MapDTOMapProvider
## Load the model package
```dart
import 'package:manager_api_new/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)

View File

@ -0,0 +1,14 @@
# manager_api_new.model.MapDTOMapType
## Load the model package
```dart
import 'package:manager_api_new/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)

View File

@ -0,0 +1,14 @@
# manager_api_new.model.MapDTOMapTypeMapbox
## Load the model package
```dart
import 'package:manager_api_new/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)

View File

@ -0,0 +1,14 @@
# manager_api_new.model.MapProvider
## Load the model package
```dart
import 'package:manager_api_new/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)

View File

@ -0,0 +1,14 @@
# manager_api_new.model.MapTypeMapBox
## Load the model package
```dart
import 'package:manager_api_new/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)

View File

@ -0,0 +1,16 @@
# manager_api_new.model.PDFFileDTO
## Load the model package
```dart
import 'package:manager_api_new/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)

View File

@ -8,8 +8,7 @@ import 'package:manager_api_new/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)

View File

@ -0,0 +1,14 @@
# manager_api_new.model.QuestionDTOImageBackgroundResourceType
## Load the model package
```dart
import 'package:manager_api_new/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)

View File

@ -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';

View File

@ -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':

View File

@ -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();
}

View File

@ -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;

View File

@ -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'),

View 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>{
};
}

View 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>{
};
}

View 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>{
};
}

View 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;
}

View 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;
}

View File

@ -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;

View 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>{
};
}

View 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_new/api.dart';
import 'package:test/test.dart';
// tests for MapDTOMapProvider
void main() {
// final instance = MapDTOMapProvider();
group('test MapDTOMapProvider', () {
});
}

View 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_new/api.dart';
import 'package:test/test.dart';
// tests for MapDTOMapTypeMapbox
void main() {
// final instance = MapDTOMapTypeMapbox();
group('test MapDTOMapTypeMapbox', () {
});
}

View 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_new/api.dart';
import 'package:test/test.dart';
// tests for MapDTOMapType
void main() {
// final instance = MapDTOMapType();
group('test MapDTOMapType', () {
});
}

View 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_new/api.dart';
import 'package:test/test.dart';
// tests for MapProvider
void main() {
group('test MapProvider', () {
});
}

View 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_new/api.dart';
import 'package:test/test.dart';
// tests for MapTypeMapBox
void main() {
group('test MapTypeMapBox', () {
});
}

View File

@ -0,0 +1,27 @@
//
// 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_new/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
});
});
}