update service generation + Update Quiz + Puzzle + Map
This commit is contained in:
parent
0c526fe53e
commit
a646adc550
148
lib/Components/category_input_container.dart
Normal file
148
lib/Components/category_input_container.dart
Normal file
@ -0,0 +1,148 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.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/app_context.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
|
||||
class CategoryInputContainer extends StatefulWidget {
|
||||
final Color color;
|
||||
final String label;
|
||||
final List<CategorieDTO> initialValue;
|
||||
final ValueChanged<List<CategorieDTO>> onChanged;
|
||||
const CategoryInputContainer({
|
||||
Key? key,
|
||||
this.color = kSecond,
|
||||
required this.label,
|
||||
required this.initialValue,
|
||||
required this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CategoryInputContainerState createState() => _CategoryInputContainerState();
|
||||
}
|
||||
|
||||
class _CategoryInputContainerState extends State<CategoryInputContainer> {
|
||||
|
||||
@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<CategorieDTO> newValues = <CategorieDTO>[];
|
||||
List<CategorieDTO> initials = widget.initialValue;
|
||||
showCreateOrUpdateCategories("Catégories", initials, newValues, (value) {
|
||||
widget.onChanged(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,
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
showCreateOrUpdateCategories(String modalLabel, List<CategorieDTO> values, List<CategorieDTO> 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: CategoryList(categories: 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
|
||||
);
|
||||
}
|
||||
83
lib/Components/dropDown_input_container.dart
Normal file
83
lib/Components/dropDown_input_container.dart
Normal file
@ -0,0 +1,83 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
import 'package:manager_api_new/api.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
|
||||
class DropDownInputContainer extends StatefulWidget {
|
||||
final String label;
|
||||
final List<CategorieDTO> categories;
|
||||
final CategorieDTO? initialValue;
|
||||
final ValueChanged<CategorieDTO>? onChange;
|
||||
const DropDownInputContainer({
|
||||
Key? key,
|
||||
required this.label,
|
||||
required this.categories,
|
||||
required this.initialValue,
|
||||
this.onChange,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_DropDownInputContainerState createState() => _DropDownInputContainerState();
|
||||
}
|
||||
|
||||
class _DropDownInputContainerState extends State<DropDownInputContainer> {
|
||||
List<CategorieDTO> categoriesToShow = [];
|
||||
CategorieDTO? selectedCategorieDTO;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if(widget.initialValue != null) {
|
||||
selectedCategorieDTO = widget.categories.firstWhere((element) => element.order == widget.initialValue!.order);
|
||||
}
|
||||
List<TranslationDTO> label = [];
|
||||
label.add(TranslationDTO(language: "FR", value: "Aucune catégorie"));
|
||||
categoriesToShow.add(CategorieDTO(order: -1, label: label));
|
||||
categoriesToShow.addAll(widget.categories);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
/*final appContext = Provider.of<AppContext>(context);
|
||||
Size size = MediaQuery.of(context).size;*/
|
||||
|
||||
return 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: DropdownButton<CategorieDTO>(
|
||||
value: selectedCategorieDTO,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
iconSize: 24,
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: kWhite),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: kPrimaryColor,
|
||||
),
|
||||
onChanged: (CategorieDTO? newValue) {
|
||||
setState(() {
|
||||
selectedCategorieDTO = newValue!;
|
||||
widget.onChange!(selectedCategorieDTO!);
|
||||
});
|
||||
},
|
||||
items: categoriesToShow.map<DropdownMenuItem<CategorieDTO>>((CategorieDTO value) {
|
||||
return DropdownMenuItem<CategorieDTO>(
|
||||
value: value,
|
||||
child: HtmlWidget(
|
||||
value.label == null ? "" : value.label![0].value!,
|
||||
textStyle: TextStyle(fontSize: 15, color: Colors.black, fontWeight: FontWeight.w400)
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/multi_input_modal.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_html_modal.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:manager_api_new/api.dart';
|
||||
|
||||
class MultiStringInputAndResourceContainer extends StatelessWidget {
|
||||
final Color color;
|
||||
final String label;
|
||||
final String modalLabel;
|
||||
final List<TranslationAndResourceDTO> initialValue;
|
||||
final Function onGetResult;
|
||||
final int maxLines;
|
||||
final bool isTitle;
|
||||
final bool isAudio;
|
||||
final double fontSize;
|
||||
const MultiStringInputAndResourceContainer({
|
||||
Key? key,
|
||||
this.color = kSecond,
|
||||
required this.label,
|
||||
required this.modalLabel,
|
||||
required this.initialValue,
|
||||
required this.onGetResult,
|
||||
required this.maxLines,
|
||||
required this.isTitle,
|
||||
this.isAudio = false,
|
||||
this.fontSize = 25,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
Size size = MediaQuery.of(context).size;
|
||||
return Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: AutoSizeText(
|
||||
label,
|
||||
style: TextStyle(fontSize: fontSize, fontWeight: FontWeight.w300),
|
||||
maxLines: 2,
|
||||
maxFontSize: fontSize,
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Container(
|
||||
width: size.width *0.15,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
List<TranslationAndResourceDTO> newValues = <TranslationAndResourceDTO>[];
|
||||
|
||||
List<TranslationAndResourceDTO> initials = initialValue;
|
||||
if(initials == null) {
|
||||
initials = [];
|
||||
}
|
||||
|
||||
languages.forEach((value) {
|
||||
if(initials.map((iv) => iv.language).contains(value)) {
|
||||
newValues.add(TranslationAndResourceDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!);
|
||||
} else {
|
||||
// New language
|
||||
newValues.add(TranslationAndResourceDTO(language: value, value: "", resourceType: null, resourceId: null, resourceUrl: null));
|
||||
}
|
||||
});
|
||||
|
||||
showMultiStringInputAndResourceHTML(label, modalLabel, isTitle, initials, newValues, onGetResult, maxLines, isAudio, context);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 5, right: 5, top: 15, bottom: 15),
|
||||
child: Center(
|
||||
child: AutoSizeText(
|
||||
isAudio ? "Changer audios" : "Changer traductions",
|
||||
style: TextStyle(color: kWhite),
|
||||
maxLines: 2,
|
||||
)
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/message_notification.dart';
|
||||
import 'package:manager_app/Components/rounded_button.dart';
|
||||
import 'package:manager_app/Components/translation_input_and_resource_container.dart';
|
||||
import 'package:manager_app/Components/translation_input_container.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:manager_api_new/api.dart';
|
||||
@ -46,9 +48,15 @@ showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List<Tr
|
||||
press: () {
|
||||
Function deepEq = const DeepCollectionEquality().equals;
|
||||
if (!deepEq(values, newValues)) {
|
||||
onGetResult(newValues);
|
||||
if(newValues.any((label) => label.value == null || label.value!.trim() == "")) {
|
||||
showNotification(kPrimaryColor, kWhite, "La traduction n'est pas complète", context, null);
|
||||
} else {
|
||||
onGetResult(newValues);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} else {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
fontSize: 20,
|
||||
),
|
||||
@ -60,3 +68,64 @@ showMultiStringInputHTML (String label, String modalLabel, bool isTitle, List<Tr
|
||||
}, context: context
|
||||
);
|
||||
}
|
||||
|
||||
showMultiStringInputAndResourceHTML (String label, String modalLabel, bool isTitle, List<TranslationAndResourceDTO> values, List<TranslationAndResourceDTO> newValues, Function onGetResult, int maxLines, bool isAudio, BuildContext context) {
|
||||
showDialog(
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
||||
),
|
||||
title: Center(child: Text(modalLabel)),
|
||||
content: SingleChildScrollView(
|
||||
child: TranslationInputAndResourceContainer(isTitle: isTitle, values: values, newValues: newValues, onGetResult: onGetResult, maxLines: maxLines, isAudio: isAudio)
|
||||
),
|
||||
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)) {
|
||||
if(newValues.any((label) => label.value == null || label.value!.trim() == "")) {
|
||||
showNotification(kPrimaryColor, kWhite, "La traduction n'est pas complète", context, null);
|
||||
} else {
|
||||
onGetResult(newValues);
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
} else {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}, context: context
|
||||
);
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ class ResourceInputContainer extends StatefulWidget {
|
||||
final bool isSmall;
|
||||
final double fontSize;
|
||||
final List<ResourceType> inResourceTypes;
|
||||
final bool isLanguageTab;
|
||||
const ResourceInputContainer({
|
||||
Key? key,
|
||||
this.color = kSecond,
|
||||
@ -26,7 +27,8 @@ class ResourceInputContainer extends StatefulWidget {
|
||||
this.imageFit = BoxFit.cover,
|
||||
this.isSmall = false,
|
||||
this.fontSize = 25,
|
||||
this.inResourceTypes = const [ResourceType.Image, ResourceType.ImageUrl]
|
||||
this.inResourceTypes = const [ResourceType.Image, ResourceType.ImageUrl],
|
||||
this.isLanguageTab = false
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -44,7 +46,10 @@ class _ResourceInputContainerState extends State<ResourceInputContainer> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
if(widget.isLanguageTab) {
|
||||
resourceIdToShow = widget.initialValue;
|
||||
}
|
||||
|
||||
return Container(
|
||||
child: Row(
|
||||
children: [
|
||||
@ -95,7 +100,6 @@ class _ResourceInputContainerState extends State<ResourceInputContainer> {
|
||||
if (resourceIdToShow != null) {
|
||||
Size size = MediaQuery.of(context).size;
|
||||
final appContext = Provider.of<AppContext>(context);
|
||||
print("TODO get element");
|
||||
return FutureBuilder(
|
||||
future: getResource(resourceIdToShow!, appContext),
|
||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||
|
||||
230
lib/Components/translation_input_and_resource_container.dart
Normal file
230
lib/Components/translation_input_and_resource_container.dart
Normal file
@ -0,0 +1,230 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_api_new/api.dart';
|
||||
import 'package:manager_app/Components/audio_input_container.dart';
|
||||
import 'package:manager_app/Components/resource_input_container.dart';
|
||||
import 'package:manager_app/app_context.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:quill_html_editor/quill_html_editor.dart';
|
||||
|
||||
import 'flag_decoration.dart';
|
||||
|
||||
class _TranslationInputAndResourceContainerState extends State<TranslationInputAndResourceContainer> with TickerProviderStateMixin {
|
||||
TabController? _tabController;
|
||||
QuillEditorController controllerQuill = QuillEditorController();
|
||||
ValueNotifier<String?>? currentLanguage;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = new TabController(length: widget.newValues.length, vsync: this);
|
||||
currentLanguage = ValueNotifier<String>(widget.newValues.first.language!);
|
||||
controllerQuill.insertText(widget.newValues[_tabController!.index].value!);
|
||||
|
||||
controllerQuill.onTextChanged((p0) async {
|
||||
var plainText = await controllerQuill.getPlainText();
|
||||
if(widget.isTitle) {
|
||||
if(plainText.length > 60) {
|
||||
print("to much text au dessus");
|
||||
controllerQuill.undo();
|
||||
}
|
||||
} else {
|
||||
if(plainText.length > 2500) {
|
||||
print("to much text description au dessus");
|
||||
controllerQuill.undo();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
_tabController!.addListener(() {
|
||||
if (!_tabController!.indexIsChanging) {
|
||||
setState(() {
|
||||
currentLanguage!.value = widget.newValues[_tabController!.index].language;
|
||||
if(!widget.isAudio) {
|
||||
controllerQuill.clear();
|
||||
controllerQuill.insertText(widget.newValues[_tabController!.index].value!);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_tabController!.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final customToolBarList = widget.isTitle ? [
|
||||
ToolBarStyle.bold,
|
||||
ToolBarStyle.italic,
|
||||
ToolBarStyle.color,
|
||||
ToolBarStyle.background,
|
||||
ToolBarStyle.clean
|
||||
] : [
|
||||
ToolBarStyle.bold,
|
||||
ToolBarStyle.italic,
|
||||
ToolBarStyle.color,
|
||||
ToolBarStyle.background,
|
||||
ToolBarStyle.listBullet,
|
||||
ToolBarStyle.listOrdered,
|
||||
ToolBarStyle.clean
|
||||
];
|
||||
|
||||
return Container(
|
||||
height: widget.isTitle ? MediaQuery.of(context).size.height *0.45 : MediaQuery.of(context).size.height *0.5,
|
||||
//color: Colors.orange,
|
||||
width: MediaQuery.of(context).size.width *0.7,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 300,
|
||||
minWidth: 300
|
||||
),
|
||||
child: DefaultTabController(
|
||||
length: widget.newValues.length,
|
||||
child: Column(
|
||||
children: [
|
||||
RotatedBox(
|
||||
quarterTurns: 0, // Can be used to test vertical tab in case of smaller screen
|
||||
child: TabBar(
|
||||
indicatorColor: kPrimaryColor,
|
||||
//overlayColor: MaterialStateProperty().c,
|
||||
labelColor: kPrimaryColor,
|
||||
unselectedLabelColor: Colors.black,
|
||||
controller: _tabController,
|
||||
tabs: widget.newValues.map((v) => Tab(icon: FlagDecoration(language: v.language!))).toList(), // text: v.language!.toUpperCase(),
|
||||
),
|
||||
),
|
||||
getTranslation(context, Provider.of<AppContext>(context), controllerQuill, customToolBarList, widget.isTitle, widget.isAudio, widget.newValues, currentLanguage!)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getTranslation(BuildContext context, AppContext appContext, QuillEditorController controllerQuill, List<ToolBarStyle> customToolBarList, bool isTitle, bool isAudio, List<TranslationAndResourceDTO> newValues, ValueNotifier<String?> currentLanguage) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
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,
|
||||
child: !isAudio ?
|
||||
Column(
|
||||
children: [
|
||||
ToolBar(
|
||||
toolBarColor: kSecond,
|
||||
activeIconColor: kPrimaryColor,
|
||||
padding: const EdgeInsets.all(8),
|
||||
iconSize: 20,
|
||||
toolBarConfig: customToolBarList,
|
||||
controller: controllerQuill,
|
||||
customButtons: [],
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: widget.isTitle ? MediaQuery.of(context).size.height *0.13 : MediaQuery.of(context).size.height *0.2,
|
||||
child: QuillHtmlEditor(
|
||||
text: newValues.where((element) => element.language! == currentLanguage.value).first.value!,
|
||||
hintText: '',
|
||||
controller: controllerQuill,
|
||||
minHeight: widget.isTitle ? 80 : 240,
|
||||
/*textStyle: _editorTextStyle,
|
||||
hintTextStyle: _hintTextStyle,*/
|
||||
hintTextAlign: TextAlign.start,
|
||||
padding: const EdgeInsets.only(left: 10, right: 10, top: 5),
|
||||
hintTextPadding: EdgeInsets.zero,
|
||||
backgroundColor: kBackgroundColor,
|
||||
ensureVisible: true,
|
||||
inputAction: widget.isTitle ? InputAction.send : InputAction.newline, // don't accept enter if title
|
||||
//onFocusChanged: (hasFocus) => debugPrint('has focus $hasFocus'),
|
||||
//onTextChanged: (text) => debugPrint('widget text change $text'),
|
||||
onTextChanged: (value) {
|
||||
newValues.where((element) => element.language! == currentLanguage.value).first.value = value;
|
||||
},
|
||||
onEditorCreated: () => debugPrint('Editor has been loaded'),
|
||||
onEditorResized: (height) =>
|
||||
debugPrint('Editor resized $height'),
|
||||
onSelectionChanged: (sel) =>
|
||||
debugPrint('${sel.index},${sel.length}'),
|
||||
),
|
||||
),
|
||||
ValueListenableBuilder<String?>(
|
||||
valueListenable: currentLanguage,
|
||||
builder: (context, value, _) {
|
||||
return ResourceInputContainer(
|
||||
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],
|
||||
isLanguageTab: true,
|
||||
onChanged: (ResourceDTO resource) {
|
||||
setState(() {
|
||||
if(resource.id == null) {
|
||||
newValues.where((element) => element.language! == value).first.resourceId = null;
|
||||
newValues.where((element) => element.language! == value).first.resourceUrl = null;
|
||||
newValues.where((element) => element.language! == value).first.resourceType = null;
|
||||
} else {
|
||||
newValues.where((element) => element.language! == value).first.resourceId = resource.id;
|
||||
newValues.where((element) => element.language! == value).first.resourceUrl = resource.url;
|
||||
newValues.where((element) => element.language! == value).first.resourceType = resource.type;
|
||||
}
|
||||
});
|
||||
},
|
||||
isSmall: true
|
||||
);
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
) :
|
||||
Container(
|
||||
width: 250,
|
||||
height: 120,
|
||||
child: ValueListenableBuilder<String?>(
|
||||
valueListenable: currentLanguage,
|
||||
builder: (context, value, _) {
|
||||
return AudioInputContainer(
|
||||
initialValue: newValues.where((element) => element.language! == value).first.value,
|
||||
color: kPrimaryColor,
|
||||
onChanged: (ResourceDTO resource) {
|
||||
newValues.where((element) => element.language! == value).first.value = resource.id;
|
||||
},
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TranslationInputAndResourceContainer extends StatefulWidget {
|
||||
TranslationInputAndResourceContainer({
|
||||
Key? key,
|
||||
required this.isTitle,
|
||||
required this.values,
|
||||
required this.newValues,
|
||||
required this.onGetResult,
|
||||
required this.maxLines,
|
||||
required this.isAudio,
|
||||
}) : super(key: key);
|
||||
|
||||
bool isTitle;
|
||||
List<TranslationAndResourceDTO> values;
|
||||
List<TranslationAndResourceDTO> newValues;
|
||||
Function onGetResult;
|
||||
int maxLines;
|
||||
bool isAudio;
|
||||
|
||||
@override
|
||||
State<TranslationInputAndResourceContainer> createState() => _TranslationInputAndResourceContainerState();
|
||||
}
|
||||
@ -94,7 +94,7 @@ class _TranslationInputContainerState extends State<TranslationInputContainer> w
|
||||
backgroundColor: kBackgroundColor,
|
||||
ensureVisible: true,
|
||||
inputAction: widget.isTitle ? InputAction.send : InputAction.newline, // don't accept enter if title
|
||||
onFocusChanged: (hasFocus) => debugPrint('has focus $hasFocus'),
|
||||
//onFocusChanged: (hasFocus) => debugPrint('has focus $hasFocus'),
|
||||
//onTextChanged: (text) => debugPrint('widget text change $text'),
|
||||
onTextChanged: (value) {
|
||||
newValues.where((element) => element.language! == currentLanguage.value).first.value = value;
|
||||
|
||||
@ -0,0 +1,253 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_html_modal.dart';
|
||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/new_update_categorie.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 CategoryList extends StatefulWidget {
|
||||
final List<CategorieDTO> categories;
|
||||
final ValueChanged<List<CategorieDTO>> onChanged;
|
||||
const CategoryList({
|
||||
Key? key,
|
||||
required this.categories,
|
||||
required this.onChanged,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CategoryListState createState() => _CategoryListState();
|
||||
}
|
||||
|
||||
class _CategoryListState extends State<CategoryList> {
|
||||
late List<CategorieDTO> categoriesMiddle;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
categoriesMiddle = new List<CategorieDTO>.from(widget.categories);
|
||||
categoriesMiddle.sort((a, b) => a.order!.compareTo(b.order!));
|
||||
}
|
||||
|
||||
void _resetOrder() {
|
||||
setState(
|
||||
() {
|
||||
var i = 0;
|
||||
categoriesMiddle.forEach((category) {
|
||||
category.order = i;
|
||||
i++;
|
||||
});
|
||||
widget.onChanged(categoriesMiddle);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _onReorder(int oldIndex, int newIndex) {
|
||||
setState(
|
||||
() {
|
||||
if (newIndex > oldIndex) {
|
||||
newIndex -= 1;
|
||||
}
|
||||
final CategorieDTO item = categoriesMiddle.removeAt(oldIndex);
|
||||
categoriesMiddle.insert(newIndex, item);
|
||||
|
||||
var i = 0;
|
||||
categoriesMiddle.forEach((category) {
|
||||
category.order = i;
|
||||
i++;
|
||||
});
|
||||
widget.onChanged(categoriesMiddle);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@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, categoriesMiddle[index], size, appContext),
|
||||
);
|
||||
},
|
||||
itemCount: categoriesMiddle.length,
|
||||
onReorder: _onReorder
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 10,
|
||||
right: 10,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
CategorieDTO newCategory = CategorieDTO(order: null);
|
||||
|
||||
var result = await showNewOrUpdateCategory(newCategory, appContext, context, "Création catégorie");
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
result.order = categoriesMiddle.length;
|
||||
categoriesMiddle.add(result);
|
||||
widget.onChanged(categoriesMiddle);
|
||||
});
|
||||
}
|
||||
},
|
||||
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, CategorieDTO category, Size size, AppContext appContext) {
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: size.width *0.8,
|
||||
height: 50,
|
||||
child: Row(
|
||||
children: [
|
||||
if(category.iconResourceId != null) Container(
|
||||
height: 60,
|
||||
width: 60,
|
||||
decoration: imageBoxDecoration(category, appContext),
|
||||
margin: EdgeInsets.symmetric(horizontal: 10),
|
||||
),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: HtmlWidget(
|
||||
category.label == null ? "" : category.label![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 showNewOrUpdateCategory(category, appContext, context, "Modification catégorie");
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
print("RESUUULT MODIFYY ");
|
||||
category = result;
|
||||
categoriesMiddle[category.order!] = category;
|
||||
widget.onChanged(categoriesMiddle);
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
color: kPrimaryColor,
|
||||
size: 25.0,
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
Tooltip(
|
||||
message: "Supprimer",
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
categoriesMiddle.removeAt(category.order!);
|
||||
_resetOrder();
|
||||
widget.onChanged(categoriesMiddle);
|
||||
});
|
||||
},
|
||||
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
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
imageBoxDecoration(CategorieDTO categorieDTO, appContext) {
|
||||
return BoxDecoration(
|
||||
color: kBackgroundColor,
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(width: 1.5, color: kSecond),
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
image: categorieDTO.iconUrl != null ? new DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: new NetworkImage(
|
||||
categorieDTO.iconUrl!,
|
||||
),
|
||||
) : null,
|
||||
);
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
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';
|
||||
@ -129,6 +130,20 @@ class _MapConfigState extends State<MapConfig> {
|
||||
mapDTO.zoom = value.toInt();
|
||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||
},
|
||||
),
|
||||
Container(
|
||||
height: 70,
|
||||
child: CategoryInputContainer(
|
||||
label: "Catégories :",
|
||||
initialValue: mapDTO.categories != null ? mapDTO.categories! : [],
|
||||
color: kPrimaryColor,
|
||||
onChanged: (List<CategorieDTO>? value) {
|
||||
if(value != null) {
|
||||
mapDTO.categories = value;
|
||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||
}
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
@ -176,15 +191,16 @@ class _MapConfigState extends State<MapConfig> {
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
showNewOrUpdateGeoPoint(
|
||||
null,
|
||||
(GeoPointDTO geoPoint) {
|
||||
setState(() {
|
||||
mapDTO.points!.add(geoPoint);
|
||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||
});
|
||||
},
|
||||
appContext,
|
||||
context);
|
||||
mapDTO,
|
||||
null,
|
||||
(GeoPointDTO geoPoint) {
|
||||
setState(() {
|
||||
mapDTO.points!.add(geoPoint);
|
||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||
});
|
||||
},
|
||||
appContext,
|
||||
context);
|
||||
},
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.width * 0.04,
|
||||
@ -252,15 +268,16 @@ class _MapConfigState extends State<MapConfig> {
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
showNewOrUpdateGeoPoint(
|
||||
mapDTO.points![index],
|
||||
(GeoPointDTO geoPoint) {
|
||||
setState(() {
|
||||
mapDTO.points![index] = geoPoint;
|
||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||
});
|
||||
},
|
||||
appContext,
|
||||
context);
|
||||
mapDTO,
|
||||
mapDTO.points![index],
|
||||
(GeoPointDTO geoPoint) {
|
||||
setState(() {
|
||||
mapDTO.points![index] = geoPoint;
|
||||
widget.onChanged(jsonEncode(mapDTO).toString());
|
||||
});
|
||||
},
|
||||
appContext,
|
||||
context);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
|
||||
@ -0,0 +1,155 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_and_resource_container.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_html_modal.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/Components/text_form_input_container.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<CategorieDTO?> showNewOrUpdateCategory(CategorieDTO? inputCategorieDTO, AppContext appContext, BuildContext context, String text) async {
|
||||
CategorieDTO categorieDTO = new CategorieDTO();
|
||||
|
||||
if (inputCategorieDTO != null) {
|
||||
categorieDTO = inputCategorieDTO;
|
||||
} else {
|
||||
categorieDTO.label = <TranslationDTO>[];
|
||||
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
|
||||
var translationMessageDTO = new TranslationDTO();
|
||||
translationMessageDTO.language = element;
|
||||
translationMessageDTO.value = "";
|
||||
|
||||
categorieDTO.label!.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: MultiStringInputContainer(
|
||||
label: "Nom affiché :",
|
||||
modalLabel: text,
|
||||
fontSize: 20,
|
||||
color: kPrimaryColor,
|
||||
initialValue: categorieDTO.label != null ? categorieDTO.label! : [],
|
||||
onGetResult: (value) {
|
||||
if (categorieDTO.label != value) {
|
||||
categorieDTO.label = value;
|
||||
}
|
||||
},
|
||||
maxLines: 1,
|
||||
isTitle: true,
|
||||
isHTML: 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: inputCategorieDTO != null ? 220: 150,
|
||||
height: 70,
|
||||
child: RoundedButton(
|
||||
text: inputCategorieDTO != null ? "Sauvegarder" : "Créer",
|
||||
icon: Icons.check,
|
||||
color: kPrimaryColor,
|
||||
textColor: kWhite,
|
||||
press: () {
|
||||
if(categorieDTO.label != null && categorieDTO.label!.isNotEmpty)
|
||||
{
|
||||
Navigator.pop(dialogContext, categorieDTO);
|
||||
}
|
||||
},
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
), context: context
|
||||
);
|
||||
return result;
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/dropDown_input_container.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_container.dart';
|
||||
import 'package:manager_app/Components/rounded_button.dart';
|
||||
import 'package:manager_app/Components/string_input_container.dart';
|
||||
@ -10,7 +11,7 @@ import 'package:manager_app/app_context.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:manager_api_new/api.dart';
|
||||
|
||||
void showNewOrUpdateGeoPoint(GeoPointDTO? inputGeoPointDTO, Function getResult, AppContext appContext, BuildContext context) {
|
||||
void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Function getResult, AppContext appContext, BuildContext context) {
|
||||
GeoPointDTO geoPointDTO = new GeoPointDTO();
|
||||
|
||||
if (inputGeoPointDTO != null) {
|
||||
@ -37,7 +38,7 @@ void showNewOrUpdateGeoPoint(GeoPointDTO? inputGeoPointDTO, Function getResult,
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.0))
|
||||
),
|
||||
content: Container(
|
||||
width: size.width *0.7,
|
||||
width: size.width *0.8,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
@ -113,6 +114,24 @@ void showNewOrUpdateGeoPoint(GeoPointDTO? inputGeoPointDTO, Function getResult,
|
||||
isTitle: false
|
||||
),
|
||||
),
|
||||
if(mapDTO.categories != null && mapDTO.categories!.isNotEmpty)
|
||||
Container(
|
||||
constraints: BoxConstraints(minHeight: 50, maxHeight: 80),
|
||||
child: DropDownInputContainer(
|
||||
label: "Choisir une catégorie:",
|
||||
categories: mapDTO.categories!,
|
||||
initialValue: geoPointDTO.categorie,
|
||||
onChange: (CategorieDTO? value) {
|
||||
if(value != null && value.order != -1)
|
||||
{
|
||||
geoPointDTO.categorie = value;
|
||||
} else
|
||||
{
|
||||
geoPointDTO.categorie = null;
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_and_resource_container.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';
|
||||
@ -57,11 +58,10 @@ class _PuzzleConfigState extends State<PuzzleConfig> {
|
||||
),
|
||||
Container(
|
||||
height: 100,
|
||||
child: MultiStringInputContainer(
|
||||
child: MultiStringInputAndResourceContainer(
|
||||
label: "Message départ :",
|
||||
modalLabel: "Message départ",
|
||||
fontSize: 20,
|
||||
isHTML: true,
|
||||
color: kPrimaryColor,
|
||||
initialValue: puzzleDTO.messageDebut != null ? puzzleDTO.messageDebut! : [],
|
||||
onGetResult: (value) {
|
||||
@ -75,16 +75,15 @@ class _PuzzleConfigState extends State<PuzzleConfig> {
|
||||
}
|
||||
},
|
||||
maxLines: 1,
|
||||
isTitle: true
|
||||
isTitle: false
|
||||
)
|
||||
),
|
||||
Container(
|
||||
height: 100,
|
||||
child: MultiStringInputContainer(
|
||||
child: MultiStringInputAndResourceContainer(
|
||||
label: "Message fin :",
|
||||
modalLabel: "Message fin",
|
||||
fontSize: 20,
|
||||
isHTML: true,
|
||||
color: kPrimaryColor,
|
||||
initialValue: puzzleDTO.messageFin != null ? puzzleDTO.messageFin! : [],
|
||||
onGetResult: (value) {
|
||||
@ -96,7 +95,7 @@ class _PuzzleConfigState extends State<PuzzleConfig> {
|
||||
}
|
||||
},
|
||||
maxLines: 1,
|
||||
isTitle: true
|
||||
isTitle: false
|
||||
)
|
||||
),
|
||||
],
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
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/message_notification.dart';
|
||||
@ -17,11 +18,11 @@ Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO? inputQuestionDTO,
|
||||
if (inputQuestionDTO != null) {
|
||||
questionDTO = inputQuestionDTO;
|
||||
} else {
|
||||
questionDTO.label = <TranslationDTO>[];
|
||||
questionDTO.label = <TranslationAndResourceDTO>[];
|
||||
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
|
||||
var translationMessageDTO = new TranslationDTO();
|
||||
var translationMessageDTO = new TranslationAndResourceDTO();
|
||||
translationMessageDTO.language = element;
|
||||
translationMessageDTO.value = "";
|
||||
|
||||
@ -56,16 +57,18 @@ Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO? inputQuestionDTO,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ResourceInputContainer(
|
||||
label: "Image :",
|
||||
initialValue: questionDTO.resourceId,
|
||||
label: "Image fond d'écran :",
|
||||
initialValue: questionDTO.imageBackgroundResourceId,
|
||||
color: kPrimaryColor,
|
||||
onChanged: (ResourceDTO resource) {
|
||||
if(resource.id == null) {
|
||||
questionDTO.resourceId = null;
|
||||
questionDTO.resourceUrl = null;
|
||||
questionDTO.imageBackgroundResourceId = null;
|
||||
questionDTO.imageBackgroundResourceUrl = null;
|
||||
questionDTO.imageBackgroundResourceType = null;
|
||||
} else {
|
||||
questionDTO.resourceId = resource.id;
|
||||
questionDTO.resourceUrl = resource.url;
|
||||
questionDTO.imageBackgroundResourceId = resource.id;
|
||||
questionDTO.imageBackgroundResourceUrl = resource.url;
|
||||
questionDTO.imageBackgroundResourceType = resource.type;
|
||||
}
|
||||
},
|
||||
isSmall: true
|
||||
@ -74,11 +77,10 @@ Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO? inputQuestionDTO,
|
||||
//color: Colors.orangeAccent,
|
||||
height: size.height * 0.15,
|
||||
constraints: BoxConstraints(minHeight: 50, maxHeight: 80),
|
||||
child: MultiStringInputContainer(
|
||||
label: "Question:",
|
||||
child: MultiStringInputAndResourceContainer(
|
||||
label: "Question :",
|
||||
modalLabel: "Question",
|
||||
fontSize: 20,
|
||||
isHTML: true,
|
||||
color: kPrimaryColor,
|
||||
initialValue: questionDTO.label != null ? questionDTO.label! : [],
|
||||
onGetResult: (value) {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:manager_app/Components/message_notification.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_and_resource_container.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_container.dart';
|
||||
import 'package:manager_app/Components/rounded_button.dart';
|
||||
import 'package:manager_app/Components/text_form_input_container.dart';
|
||||
@ -9,17 +10,18 @@ import 'package:manager_app/app_context.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:manager_api_new/api.dart';
|
||||
|
||||
@deprecated
|
||||
Future<ResponseDTO> showNewOrUpdateResponseQuizz(ResponseDTO? inputResponseDTO, AppContext appContext, BuildContext context, String text) async {
|
||||
ResponseDTO responseDTO = new ResponseDTO();
|
||||
|
||||
if (inputResponseDTO != null) {
|
||||
responseDTO = inputResponseDTO;
|
||||
} else {
|
||||
responseDTO.label = <TranslationDTO>[];
|
||||
responseDTO.label = <TranslationAndResourceDTO>[];
|
||||
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
|
||||
var translationMessageDTO = new TranslationDTO();
|
||||
var translationMessageDTO = new TranslationAndResourceDTO();
|
||||
translationMessageDTO.language = element;
|
||||
translationMessageDTO.value = "";
|
||||
|
||||
@ -29,6 +31,8 @@ Future<ResponseDTO> showNewOrUpdateResponseQuizz(ResponseDTO? inputResponseDTO,
|
||||
|
||||
Size size = MediaQuery.of(context).size;
|
||||
|
||||
|
||||
|
||||
//showMultiStringInputHTML("Réponse", "Modifier la réponse:", false, initials, newValues, onGetResult, 1, false, context);
|
||||
|
||||
var result = await showDialog(
|
||||
@ -47,12 +51,11 @@ Future<ResponseDTO> showNewOrUpdateResponseQuizz(ResponseDTO? inputResponseDTO,
|
||||
height: size.height * 0.25,
|
||||
width: double.infinity,
|
||||
child: Container(
|
||||
constraints: BoxConstraints(minHeight: 50, maxHeight: 80),
|
||||
child: MultiStringInputContainer(
|
||||
label: "Modifier la réponse:",
|
||||
constraints: BoxConstraints(minHeight: 50, maxHeight: 50),
|
||||
child: MultiStringInputAndResourceContainer(
|
||||
label: inputResponseDTO != null ? "Modifier les réponses :" : "Créer les réponses :",
|
||||
modalLabel: "Réponse",
|
||||
fontSize: 20,
|
||||
isHTML: true,
|
||||
color: kPrimaryColor,
|
||||
initialValue: responseDTO.label != null ? responseDTO.label! : [],
|
||||
onGetResult: (value) {
|
||||
@ -65,26 +68,6 @@ Future<ResponseDTO> showNewOrUpdateResponseQuizz(ResponseDTO? inputResponseDTO,
|
||||
),
|
||||
),
|
||||
),
|
||||
/*Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Align(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
child: Text("La réponse est valide:", style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300))
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Checkbox(
|
||||
value: responseDTO.isGood,
|
||||
checkColor: Colors.white,
|
||||
activeColor: kPrimaryColor,
|
||||
onChanged: (bool value) {
|
||||
responseDTO.isGood = !responseDTO.isGood;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),*/
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -1,4 +1,8 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_and_resource_container.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_html_modal.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';
|
||||
@ -9,17 +13,18 @@ import 'package:manager_app/app_context.dart';
|
||||
import 'package:manager_app/constants.dart';
|
||||
import 'package:manager_api_new/api.dart';
|
||||
|
||||
@deprecated
|
||||
Future<LevelDTO?> showNewOrUpdateScoreQuizz(LevelDTO? inputLevelDTO, AppContext appContext, BuildContext context, String text) async {
|
||||
LevelDTO levelDTO = new LevelDTO();
|
||||
|
||||
if (inputLevelDTO != null) {
|
||||
levelDTO = inputLevelDTO;
|
||||
} else {
|
||||
levelDTO.label = <TranslationDTO>[];
|
||||
levelDTO.label = <TranslationAndResourceDTO>[];
|
||||
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
|
||||
var translationMessageDTO = new TranslationDTO();
|
||||
var translationMessageDTO = new TranslationAndResourceDTO();
|
||||
translationMessageDTO.language = element;
|
||||
translationMessageDTO.value = "";
|
||||
|
||||
@ -27,6 +32,32 @@ Future<LevelDTO?> showNewOrUpdateScoreQuizz(LevelDTO? inputLevelDTO, AppContext
|
||||
});
|
||||
}
|
||||
|
||||
List<TranslationAndResourceDTO> newValues = <TranslationAndResourceDTO>[];
|
||||
|
||||
List<TranslationAndResourceDTO> initials = [];
|
||||
|
||||
languages.forEach((value) {
|
||||
if(initials.map((iv) => iv.language).contains(value)) {
|
||||
newValues.add(TranslationAndResourceDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!);
|
||||
} else {
|
||||
// New language
|
||||
newValues.add(TranslationAndResourceDTO(language: value, value: ""));
|
||||
}
|
||||
});
|
||||
|
||||
showMultiStringInputAndResourceHTML("Message pour un mauvais score", "Message pour un mauvais score", true, initials, newValues, (value) {
|
||||
print("RTESULTYTYT ");
|
||||
print(value);
|
||||
if(value != null && value.isNotEmpty) {
|
||||
levelDTO.label = value;
|
||||
print("RETURN VALUE");
|
||||
print(levelDTO);
|
||||
return levelDTO;
|
||||
}
|
||||
}, 1, false, context);
|
||||
|
||||
|
||||
|
||||
Size size = MediaQuery.of(context).size;
|
||||
var result = await showDialog(
|
||||
builder: (BuildContext dialogContext) => AlertDialog(
|
||||
@ -43,31 +74,13 @@ Future<LevelDTO?> showNewOrUpdateScoreQuizz(LevelDTO? inputLevelDTO, AppContext
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Center(
|
||||
child: ResourceInputContainer(
|
||||
label: "Image :",
|
||||
initialValue: levelDTO.resourceId,
|
||||
color: kPrimaryColor,
|
||||
onChanged: (ResourceDTO resource) {
|
||||
if(resource.id == null) {
|
||||
levelDTO.resourceId = null;
|
||||
levelDTO.resourceUrl = null;
|
||||
} else {
|
||||
levelDTO.resourceId = resource.id;
|
||||
levelDTO.resourceUrl = resource.url;
|
||||
}
|
||||
},
|
||||
isSmall: true
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: size.height * 0.2,
|
||||
constraints: BoxConstraints(minHeight: 50, maxHeight: 80),
|
||||
child: MultiStringInputContainer(
|
||||
child: MultiStringInputAndResourceContainer(
|
||||
label: "Message:",
|
||||
modalLabel: "Message",
|
||||
modalLabel: text,
|
||||
fontSize: 20,
|
||||
isHTML: true,
|
||||
color: kPrimaryColor,
|
||||
initialValue: levelDTO.label != null ? levelDTO.label! : [],
|
||||
onGetResult: (value) {
|
||||
@ -9,7 +9,7 @@ import 'package:manager_app/constants.dart';
|
||||
import 'package:manager_api_new/api.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'new_update_response_quizz.dart';
|
||||
import 'new_update_response_quizz - deprecated.dart';
|
||||
|
||||
class QuizzResponseList extends StatefulWidget {
|
||||
final List<ResponseDTO> responses;
|
||||
@ -33,6 +33,19 @@ class _QuizzResponseListState extends State<QuizzResponseList> {
|
||||
responsesMiddle = new List<ResponseDTO>.from(widget.responses);
|
||||
}
|
||||
|
||||
void _resetOrder() {
|
||||
setState(
|
||||
() {
|
||||
var i = 0;
|
||||
responsesMiddle.forEach((category) {
|
||||
category.order = i;
|
||||
i++;
|
||||
});
|
||||
widget.onChanged(responsesMiddle);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _onReorder(int oldIndex, int newIndex) {
|
||||
setState(
|
||||
() {
|
||||
@ -86,46 +99,62 @@ class _QuizzResponseListState extends State<QuizzResponseList> {
|
||||
),
|
||||
),
|
||||
if(responsesMiddle.length < 4)
|
||||
Positioned(
|
||||
bottom: 10,
|
||||
right: 10,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
var result = await showNewOrUpdateResponseQuizz(null, appContext, context, "Réponse");
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
result.order = responsesMiddle.length;
|
||||
result.isGood = false;
|
||||
responsesMiddle.add(result);
|
||||
widget.onChanged(responsesMiddle);
|
||||
Positioned(
|
||||
bottom: 10,
|
||||
right: 10,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
ResponseDTO newResponse = ResponseDTO(order: null);
|
||||
|
||||
List<TranslationAndResourceDTO> newValues = <TranslationAndResourceDTO>[];
|
||||
|
||||
List<TranslationAndResourceDTO> initials = [];
|
||||
|
||||
languages.forEach((value) {
|
||||
if(initials.map((iv) => iv.language).contains(value)) {
|
||||
newValues.add(TranslationAndResourceDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!);
|
||||
} else {
|
||||
// New language
|
||||
newValues.add(TranslationAndResourceDTO(language: value, value: ""));
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
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
|
||||
),
|
||||
],
|
||||
|
||||
showMultiStringInputAndResourceHTML("Réponse", "Créer la réponse", true, initials, newValues, (value) {
|
||||
if(value != null && value.isNotEmpty) {
|
||||
setState(() {
|
||||
newResponse.label = value;
|
||||
newResponse.order = responsesMiddle.length;
|
||||
newResponse.isGood = false;
|
||||
responsesMiddle.add(newResponse);
|
||||
widget.onChanged(responsesMiddle);
|
||||
});
|
||||
}
|
||||
}, 1, false, context);
|
||||
},
|
||||
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
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -177,27 +206,27 @@ class _QuizzResponseListState extends State<QuizzResponseList> {
|
||||
message: "Modifier",
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
List<TranslationDTO> newValues = <TranslationDTO>[];
|
||||
List<TranslationAndResourceDTO> newValues = <TranslationAndResourceDTO>[];
|
||||
|
||||
List<TranslationDTO> initials = response.label!;
|
||||
List<TranslationAndResourceDTO> initials = response.label!;
|
||||
if(initials == null) {
|
||||
initials = [];
|
||||
}
|
||||
|
||||
languages.forEach((value) {
|
||||
if(initials.map((iv) => iv.language).contains(value)) {
|
||||
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!);
|
||||
newValues.add(TranslationAndResourceDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!);
|
||||
} else {
|
||||
// New language
|
||||
newValues.add(TranslationDTO(language: value, value: null));
|
||||
newValues.add(TranslationAndResourceDTO(language: value, value: ""));
|
||||
}
|
||||
});
|
||||
|
||||
showMultiStringInputHTML("Réponse", "Modifier la réponse", true, initials, newValues, (value) {
|
||||
showMultiStringInputAndResourceHTML("Réponse", "Modifier la réponse", true, initials, newValues, (value) {
|
||||
setState(() {
|
||||
if (response.label! != value) {
|
||||
if (value != null && response.label! != value) {
|
||||
response.label = value;
|
||||
responsesMiddle[response.order!] = value;
|
||||
responsesMiddle[response.order!] = response;
|
||||
widget.onChanged(responsesMiddle);
|
||||
}
|
||||
});
|
||||
@ -219,6 +248,7 @@ class _QuizzResponseListState extends State<QuizzResponseList> {
|
||||
onTap: () {
|
||||
setState(() {
|
||||
responsesMiddle.removeAt(response.order!);
|
||||
_resetOrder();
|
||||
widget.onChanged(responsesMiddle);
|
||||
});
|
||||
},
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
import 'package:manager_app/Components/multi_string_input_html_modal.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';
|
||||
@ -9,7 +12,7 @@ import 'dart:convert';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'new_update_question_quizz.dart';
|
||||
import 'new_update_score_quizz.dart';
|
||||
import 'new_update_score_quizz - deprecated.dart';
|
||||
|
||||
class QuizzConfig extends StatefulWidget {
|
||||
final String? color;
|
||||
@ -84,14 +87,7 @@ class _QuizzConfigState extends State<QuizzConfig> {
|
||||
textColor: kWhite,
|
||||
icon: Icons.message,
|
||||
press: () async {
|
||||
var result = await showNewOrUpdateScoreQuizz(quizzDTO.badLevel, appContext, context, "Message pour un mauvais score");
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
quizzDTO.badLevel = result;
|
||||
widget.onChanged(jsonEncode(quizzDTO).toString());
|
||||
});
|
||||
}
|
||||
updateScoreQuizMessage(context, appContext, quizzDTO.badLevel, "Message pour un mauvais score", 0);
|
||||
},
|
||||
fontSize: 20,
|
||||
horizontal: 10,
|
||||
@ -107,14 +103,7 @@ class _QuizzConfigState extends State<QuizzConfig> {
|
||||
textColor: kWhite,
|
||||
icon: Icons.message,
|
||||
press: () async {
|
||||
var result = await showNewOrUpdateScoreQuizz(quizzDTO.mediumLevel, appContext, context, "Message pour un moyen score");
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
quizzDTO.mediumLevel = result;
|
||||
widget.onChanged(jsonEncode(quizzDTO).toString());
|
||||
});
|
||||
}
|
||||
updateScoreQuizMessage(context, appContext, quizzDTO.mediumLevel, "Message pour un score moyen", 1);
|
||||
},
|
||||
fontSize: 20,
|
||||
horizontal: 10,
|
||||
@ -130,14 +119,7 @@ class _QuizzConfigState extends State<QuizzConfig> {
|
||||
textColor: kWhite,
|
||||
icon: Icons.message,
|
||||
press: () async {
|
||||
var result = await showNewOrUpdateScoreQuizz(quizzDTO.goodLevel, appContext, context, "Message pour un bon score");
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
quizzDTO.goodLevel = result;
|
||||
widget.onChanged(jsonEncode(quizzDTO).toString());
|
||||
});
|
||||
}
|
||||
updateScoreQuizMessage(context, appContext, quizzDTO.goodLevel, "Message pour un bon score", 2);
|
||||
},
|
||||
fontSize: 20,
|
||||
horizontal: 10,
|
||||
@ -153,14 +135,7 @@ class _QuizzConfigState extends State<QuizzConfig> {
|
||||
textColor: kWhite,
|
||||
icon: Icons.message,
|
||||
press: () async {
|
||||
var result = await showNewOrUpdateScoreQuizz(quizzDTO.greatLevel, appContext, context, "Message pour un excellent score");
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
quizzDTO.greatLevel = result;
|
||||
widget.onChanged(jsonEncode(quizzDTO).toString());
|
||||
});
|
||||
}
|
||||
updateScoreQuizMessage(context, appContext, quizzDTO.greatLevel, "Message pour un excellent score", 3);
|
||||
},
|
||||
fontSize: 20,
|
||||
horizontal: 10,
|
||||
@ -263,7 +238,7 @@ class _QuizzConfigState extends State<QuizzConfig> {
|
||||
height: 75,
|
||||
child: Row(
|
||||
children: [
|
||||
if(question.resourceUrl != null) Container(
|
||||
if(question.imageBackgroundResourceUrl != null) Container(
|
||||
height: 60,
|
||||
width: 60,
|
||||
decoration: imageBoxDecoration(question, appContext),
|
||||
@ -272,11 +247,9 @@ class _QuizzConfigState extends State<QuizzConfig> {
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(2.0),
|
||||
child: AutoSizeText(
|
||||
question.label == null ? "" : question.label![0].value!,
|
||||
style: new TextStyle(fontSize: 15),
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
child: HtmlWidget(
|
||||
question.label == null ? "" : question.label![0].value!,
|
||||
textStyle: TextStyle(fontSize: 15)
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -341,6 +314,65 @@ class _QuizzConfigState extends State<QuizzConfig> {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
updateScoreQuizMessage(BuildContext context, AppContext appContext, LevelDTO? inLevelDTO, String text, int levelToUpdate) {
|
||||
LevelDTO levelDTO = new LevelDTO();
|
||||
|
||||
if (inLevelDTO != null) {
|
||||
levelDTO = inLevelDTO;
|
||||
} else {
|
||||
levelDTO.label = <TranslationAndResourceDTO>[];
|
||||
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
managerAppContext.selectedConfiguration!.languages!.forEach((element) {
|
||||
var translationMessageDTO = new TranslationAndResourceDTO();
|
||||
translationMessageDTO.language = element;
|
||||
translationMessageDTO.value = "";
|
||||
|
||||
levelDTO.label!.add(translationMessageDTO);
|
||||
});
|
||||
}
|
||||
|
||||
List<TranslationAndResourceDTO> newValues = <TranslationAndResourceDTO>[];
|
||||
|
||||
List<TranslationAndResourceDTO> initials = levelDTO.label!;
|
||||
|
||||
languages.forEach((value) {
|
||||
if(initials.map((iv) => iv.language).contains(value)) {
|
||||
newValues.add(TranslationAndResourceDTO.fromJson(jsonDecode(jsonEncode(initials.firstWhere((element) => element.language == value)))!)!);
|
||||
} else {
|
||||
// New language
|
||||
newValues.add(TranslationAndResourceDTO(language: value, value: ""));
|
||||
}
|
||||
});
|
||||
|
||||
showMultiStringInputAndResourceHTML(text, text, true, initials, newValues, (value) {
|
||||
if(value != null && value.isNotEmpty) {
|
||||
levelDTO.label = value;
|
||||
setState(() {
|
||||
switch(levelToUpdate) {
|
||||
case 0:
|
||||
// badLevel
|
||||
quizzDTO.badLevel = levelDTO;
|
||||
break;
|
||||
case 1:
|
||||
// mediumLevel
|
||||
quizzDTO.mediumLevel = levelDTO;
|
||||
break;
|
||||
case 2:
|
||||
// goodLevel
|
||||
quizzDTO.goodLevel = levelDTO;
|
||||
break;
|
||||
case 3:
|
||||
// greatLevel
|
||||
quizzDTO.greatLevel = levelDTO;
|
||||
break;
|
||||
}
|
||||
widget.onChanged(jsonEncode(quizzDTO).toString());
|
||||
});
|
||||
}
|
||||
}, 1, false, context);
|
||||
}
|
||||
}
|
||||
|
||||
boxDecoration() {
|
||||
@ -366,11 +398,11 @@ imageBoxDecoration(QuestionDTO questionDTO, appContext) {
|
||||
shape: BoxShape.rectangle,
|
||||
border: Border.all(width: 1.5, color: kSecond),
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
image: questionDTO.resourceUrl != null ? new DecorationImage(
|
||||
image: questionDTO.imageBackgroundResourceUrl != null ? new DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: new NetworkImage(
|
||||
questionDTO.resourceUrl!,
|
||||
questionDTO.imageBackgroundResourceUrl!,
|
||||
),
|
||||
) : null,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,13 +209,6 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
/*ColorPickerInputContainer(
|
||||
label: "Couleur principal :",
|
||||
color: configurationDTO.primaryColor,
|
||||
onChanged: (value) {
|
||||
configurationDTO.primaryColor = value;
|
||||
},
|
||||
),*/
|
||||
CheckInputContainer(
|
||||
icon: Icons.signal_wifi_off,
|
||||
label: "Hors ligne :",
|
||||
@ -287,6 +280,15 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
configurationDTO.secondaryColor = value;
|
||||
},
|
||||
),
|
||||
if(!configurationDTO.isMobile!)
|
||||
ColorPickerInputContainer(
|
||||
label: "Couleur pincipale :",
|
||||
fontSize: 20,
|
||||
color: configurationDTO.primaryColor,
|
||||
onChanged: (value) {
|
||||
configurationDTO.primaryColor = value;
|
||||
},
|
||||
),
|
||||
if(configurationDTO.isMobile!)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(bottom: 15),
|
||||
|
||||
@ -21,8 +21,6 @@ class _MainScreenState extends State<MainScreen> {
|
||||
final appContext = Provider.of<AppContext>(context);
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
|
||||
print(managerAppContext.instanceId);
|
||||
|
||||
var isFortSt = managerAppContext.instanceId == "633ee379d9405f32f166f047";
|
||||
|
||||
if(!ResponsiveBreakpoints.of(context).equals(TABLET) || isFortSt) {
|
||||
|
||||
@ -2175,12 +2175,24 @@ components:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
label:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/TranslationDTO'
|
||||
icon:
|
||||
type: string
|
||||
nullable: true
|
||||
iconResourceId:
|
||||
type: string
|
||||
nullable: true
|
||||
iconUrl:
|
||||
type: string
|
||||
nullable: true
|
||||
order:
|
||||
type: integer
|
||||
format: int32
|
||||
nullable: true
|
||||
SliderDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
@ -2279,12 +2291,33 @@ components:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/TranslationDTO'
|
||||
$ref: '#/components/schemas/TranslationAndResourceDTO'
|
||||
responses:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/ResponseDTO'
|
||||
imageBackgroundResourceId:
|
||||
type: string
|
||||
nullable: true
|
||||
imageBackgroundResourceType:
|
||||
$ref: '#/components/schemas/ResourceType'
|
||||
imageBackgroundResourceUrl:
|
||||
type: string
|
||||
nullable: true
|
||||
order:
|
||||
type: integer
|
||||
format: int32
|
||||
TranslationAndResourceDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
properties:
|
||||
language:
|
||||
type: string
|
||||
nullable: true
|
||||
value:
|
||||
type: string
|
||||
nullable: true
|
||||
resourceId:
|
||||
type: string
|
||||
nullable: true
|
||||
@ -2293,9 +2326,6 @@ components:
|
||||
resourceUrl:
|
||||
type: string
|
||||
nullable: true
|
||||
order:
|
||||
type: integer
|
||||
format: int32
|
||||
ResponseDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
@ -2304,17 +2334,9 @@ components:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/TranslationDTO'
|
||||
$ref: '#/components/schemas/TranslationAndResourceDTO'
|
||||
isGood:
|
||||
type: boolean
|
||||
resourceId:
|
||||
type: string
|
||||
nullable: true
|
||||
resourceType:
|
||||
$ref: '#/components/schemas/ResourceType'
|
||||
resourceUrl:
|
||||
type: string
|
||||
nullable: true
|
||||
order:
|
||||
type: integer
|
||||
format: int32
|
||||
@ -2326,15 +2348,7 @@ components:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/TranslationDTO'
|
||||
resourceId:
|
||||
type: string
|
||||
nullable: true
|
||||
resourceType:
|
||||
$ref: '#/components/schemas/ResourceType'
|
||||
resourceUrl:
|
||||
type: string
|
||||
nullable: true
|
||||
$ref: '#/components/schemas/TranslationAndResourceDTO'
|
||||
ArticleDTO:
|
||||
type: object
|
||||
additionalProperties: false
|
||||
@ -2376,12 +2390,12 @@ components:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/TranslationDTO'
|
||||
$ref: '#/components/schemas/TranslationAndResourceDTO'
|
||||
messageFin:
|
||||
type: array
|
||||
nullable: true
|
||||
items:
|
||||
$ref: '#/components/schemas/TranslationDTO'
|
||||
$ref: '#/components/schemas/TranslationAndResourceDTO'
|
||||
image:
|
||||
nullable: true
|
||||
oneOf:
|
||||
|
||||
@ -42,6 +42,7 @@ doc/SectionDTO.md
|
||||
doc/SectionType.md
|
||||
doc/SliderDTO.md
|
||||
doc/TokenDTO.md
|
||||
doc/TranslationAndResourceDTO.md
|
||||
doc/TranslationDTO.md
|
||||
doc/User.md
|
||||
doc/UserApi.md
|
||||
@ -99,6 +100,7 @@ lib/model/section_dto.dart
|
||||
lib/model/section_type.dart
|
||||
lib/model/slider_dto.dart
|
||||
lib/model/token_dto.dart
|
||||
lib/model/translation_and_resource_dto.dart
|
||||
lib/model/translation_dto.dart
|
||||
lib/model/user.dart
|
||||
lib/model/user_detail_dto.dart
|
||||
|
||||
@ -157,6 +157,7 @@ Class | Method | HTTP request | Description
|
||||
- [SectionType](doc\/SectionType.md)
|
||||
- [SliderDTO](doc\/SliderDTO.md)
|
||||
- [TokenDTO](doc\/TokenDTO.md)
|
||||
- [TranslationAndResourceDTO](doc\/TranslationAndResourceDTO.md)
|
||||
- [TranslationDTO](doc\/TranslationDTO.md)
|
||||
- [User](doc\/User.md)
|
||||
- [UserDetailDTO](doc\/UserDetailDTO.md)
|
||||
|
||||
@ -8,8 +8,11 @@ import 'package:manager_api_new/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **String** | | [optional]
|
||||
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||
**icon** | **String** | | [optional]
|
||||
**iconResourceId** | **String** | | [optional]
|
||||
**iconUrl** | **String** | | [optional]
|
||||
**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,11 @@ import 'package:manager_api_new/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **String** | | [optional]
|
||||
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||
**icon** | **String** | | [optional]
|
||||
**iconResourceId** | **String** | | [optional]
|
||||
**iconUrl** | **String** | | [optional]
|
||||
**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,10 +8,7 @@ import 'package:manager_api_new/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||
**resourceId** | **String** | | [optional]
|
||||
**resourceType** | [**ResourceType**](ResourceType.md) | | [optional]
|
||||
**resourceUrl** | **String** | | [optional]
|
||||
**label** | [**List<TranslationAndResourceDTO>**](TranslationAndResourceDTO.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)
|
||||
|
||||
|
||||
@ -8,8 +8,8 @@ import 'package:manager_api_new/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**messageDebut** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||
**messageFin** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||
**messageDebut** | [**List<TranslationAndResourceDTO>**](TranslationAndResourceDTO.md) | | [optional] [default to const []]
|
||||
**messageFin** | [**List<TranslationAndResourceDTO>**](TranslationAndResourceDTO.md) | | [optional] [default to const []]
|
||||
**image** | [**PuzzleDTOImage**](PuzzleDTOImage.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)
|
||||
|
||||
@ -8,11 +8,11 @@ import 'package:manager_api_new/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||
**label** | [**List<TranslationAndResourceDTO>**](TranslationAndResourceDTO.md) | | [optional] [default to const []]
|
||||
**responses** | [**List<ResponseDTO>**](ResponseDTO.md) | | [optional] [default to const []]
|
||||
**resourceId** | **String** | | [optional]
|
||||
**resourceType** | [**ResourceType**](ResourceType.md) | | [optional]
|
||||
**resourceUrl** | **String** | | [optional]
|
||||
**imageBackgroundResourceId** | **String** | | [optional]
|
||||
**imageBackgroundResourceType** | [**ResourceType**](ResourceType.md) | | [optional]
|
||||
**imageBackgroundResourceUrl** | **String** | | [optional]
|
||||
**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,10 +8,7 @@ import 'package:manager_api_new/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||
**resourceId** | **String** | | [optional]
|
||||
**resourceType** | [**ResourceType**](ResourceType.md) | | [optional]
|
||||
**resourceUrl** | **String** | | [optional]
|
||||
**label** | [**List<TranslationAndResourceDTO>**](TranslationAndResourceDTO.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)
|
||||
|
||||
|
||||
@ -8,11 +8,8 @@ import 'package:manager_api_new/api.dart';
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||
**label** | [**List<TranslationAndResourceDTO>**](TranslationAndResourceDTO.md) | | [optional] [default to const []]
|
||||
**isGood** | **bool** | | [optional]
|
||||
**resourceId** | **String** | | [optional]
|
||||
**resourceType** | [**ResourceType**](ResourceType.md) | | [optional]
|
||||
**resourceUrl** | **String** | | [optional]
|
||||
**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)
|
||||
|
||||
19
manager_api_new/doc/TranslationAndResourceDTO.md
Normal file
19
manager_api_new/doc/TranslationAndResourceDTO.md
Normal file
@ -0,0 +1,19 @@
|
||||
# manager_api_new.model.TranslationAndResourceDTO
|
||||
|
||||
## Load the model package
|
||||
```dart
|
||||
import 'package:manager_api_new/api.dart';
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**language** | **String** | | [optional]
|
||||
**value** | **String** | | [optional]
|
||||
**resourceId** | **String** | | [optional]
|
||||
**resourceType** | [**ResourceType**](ResourceType.md) | | [optional]
|
||||
**resourceUrl** | **String** | | [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)
|
||||
|
||||
|
||||
@ -69,6 +69,7 @@ part 'model/section_dto.dart';
|
||||
part 'model/section_type.dart';
|
||||
part 'model/slider_dto.dart';
|
||||
part 'model/token_dto.dart';
|
||||
part 'model/translation_and_resource_dto.dart';
|
||||
part 'model/translation_dto.dart';
|
||||
part 'model/user.dart';
|
||||
part 'model/user_detail_dto.dart';
|
||||
|
||||
@ -249,6 +249,8 @@ class ApiClient {
|
||||
return SliderDTO.fromJson(value);
|
||||
case 'TokenDTO':
|
||||
return TokenDTO.fromJson(value);
|
||||
case 'TranslationAndResourceDTO':
|
||||
return TranslationAndResourceDTO.fromJson(value);
|
||||
case 'TranslationDTO':
|
||||
return TranslationDTO.fromJson(value);
|
||||
case 'User':
|
||||
|
||||
@ -13,40 +13,70 @@ part of openapi.api;
|
||||
class CategorieDTO {
|
||||
/// Returns a new [CategorieDTO] instance.
|
||||
CategorieDTO({
|
||||
this.name,
|
||||
this.label = const [],
|
||||
this.icon,
|
||||
this.iconResourceId,
|
||||
this.iconUrl,
|
||||
this.order,
|
||||
});
|
||||
|
||||
String? name;
|
||||
List<TranslationDTO>? label;
|
||||
|
||||
String? icon;
|
||||
|
||||
String? iconResourceId;
|
||||
|
||||
String? iconUrl;
|
||||
|
||||
int? order;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is CategorieDTO &&
|
||||
other.name == name &&
|
||||
other.icon == icon;
|
||||
other.label == label &&
|
||||
other.icon == icon &&
|
||||
other.iconResourceId == iconResourceId &&
|
||||
other.iconUrl == iconUrl &&
|
||||
other.order == order;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(icon == null ? 0 : icon!.hashCode);
|
||||
(label == null ? 0 : label!.hashCode) +
|
||||
(icon == null ? 0 : icon!.hashCode) +
|
||||
(iconResourceId == null ? 0 : iconResourceId!.hashCode) +
|
||||
(iconUrl == null ? 0 : iconUrl!.hashCode) +
|
||||
(order == null ? 0 : order!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'CategorieDTO[name=$name, icon=$icon]';
|
||||
String toString() => 'CategorieDTO[label=$label, icon=$icon, iconResourceId=$iconResourceId, iconUrl=$iconUrl, order=$order]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.name != null) {
|
||||
json[r'name'] = this.name;
|
||||
if (this.label != null) {
|
||||
json[r'label'] = this.label;
|
||||
} else {
|
||||
json[r'name'] = null;
|
||||
json[r'label'] = null;
|
||||
}
|
||||
if (this.icon != null) {
|
||||
json[r'icon'] = this.icon;
|
||||
} else {
|
||||
json[r'icon'] = null;
|
||||
}
|
||||
if (this.iconResourceId != null) {
|
||||
json[r'iconResourceId'] = this.iconResourceId;
|
||||
} else {
|
||||
json[r'iconResourceId'] = null;
|
||||
}
|
||||
if (this.iconUrl != null) {
|
||||
json[r'iconUrl'] = this.iconUrl;
|
||||
} else {
|
||||
json[r'iconUrl'] = null;
|
||||
}
|
||||
if (this.order != null) {
|
||||
json[r'order'] = this.order;
|
||||
} else {
|
||||
json[r'order'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -69,8 +99,11 @@ class CategorieDTO {
|
||||
}());
|
||||
|
||||
return CategorieDTO(
|
||||
name: mapValueOfType<String>(json, r'name'),
|
||||
label: TranslationDTO.listFromJson(json[r'label']),
|
||||
icon: mapValueOfType<String>(json, r'icon'),
|
||||
iconResourceId: mapValueOfType<String>(json, r'iconResourceId'),
|
||||
iconUrl: mapValueOfType<String>(json, r'iconUrl'),
|
||||
order: mapValueOfType<int>(json, r'order'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -36,7 +36,7 @@ class GeoPointDTO {
|
||||
|
||||
List<ContentGeoPoint>? contents;
|
||||
|
||||
GeoPointDTOCategorie? categorie;
|
||||
CategorieDTO? categorie;
|
||||
|
||||
String? latitude;
|
||||
|
||||
@ -129,7 +129,7 @@ class GeoPointDTO {
|
||||
title: TranslationDTO.listFromJson(json[r'title']),
|
||||
description: TranslationDTO.listFromJson(json[r'description']),
|
||||
contents: ContentGeoPoint.listFromJson(json[r'contents']),
|
||||
categorie: GeoPointDTOCategorie.fromJson(json[r'categorie']),
|
||||
categorie: CategorieDTO.fromJson(json[r'categorie']),
|
||||
latitude: mapValueOfType<String>(json, r'latitude'),
|
||||
longitude: mapValueOfType<String>(json, r'longitude'),
|
||||
);
|
||||
|
||||
@ -13,40 +13,70 @@ part of openapi.api;
|
||||
class GeoPointDTOCategorie {
|
||||
/// Returns a new [GeoPointDTOCategorie] instance.
|
||||
GeoPointDTOCategorie({
|
||||
this.name,
|
||||
this.label = const [],
|
||||
this.icon,
|
||||
this.iconResourceId,
|
||||
this.iconUrl,
|
||||
this.order,
|
||||
});
|
||||
|
||||
String? name;
|
||||
List<TranslationDTO>? label;
|
||||
|
||||
String? icon;
|
||||
|
||||
String? iconResourceId;
|
||||
|
||||
String? iconUrl;
|
||||
|
||||
int? order;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is GeoPointDTOCategorie &&
|
||||
other.name == name &&
|
||||
other.icon == icon;
|
||||
other.label == label &&
|
||||
other.icon == icon &&
|
||||
other.iconResourceId == iconResourceId &&
|
||||
other.iconUrl == iconUrl &&
|
||||
other.order == order;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(icon == null ? 0 : icon!.hashCode);
|
||||
(label == null ? 0 : label!.hashCode) +
|
||||
(icon == null ? 0 : icon!.hashCode) +
|
||||
(iconResourceId == null ? 0 : iconResourceId!.hashCode) +
|
||||
(iconUrl == null ? 0 : iconUrl!.hashCode) +
|
||||
(order == null ? 0 : order!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'GeoPointDTOCategorie[name=$name, icon=$icon]';
|
||||
String toString() => 'GeoPointDTOCategorie[label=$label, icon=$icon, iconResourceId=$iconResourceId, iconUrl=$iconUrl, order=$order]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.name != null) {
|
||||
json[r'name'] = this.name;
|
||||
if (this.label != null) {
|
||||
json[r'label'] = this.label;
|
||||
} else {
|
||||
json[r'name'] = null;
|
||||
json[r'label'] = null;
|
||||
}
|
||||
if (this.icon != null) {
|
||||
json[r'icon'] = this.icon;
|
||||
} else {
|
||||
json[r'icon'] = null;
|
||||
}
|
||||
if (this.iconResourceId != null) {
|
||||
json[r'iconResourceId'] = this.iconResourceId;
|
||||
} else {
|
||||
json[r'iconResourceId'] = null;
|
||||
}
|
||||
if (this.iconUrl != null) {
|
||||
json[r'iconUrl'] = this.iconUrl;
|
||||
} else {
|
||||
json[r'iconUrl'] = null;
|
||||
}
|
||||
if (this.order != null) {
|
||||
json[r'order'] = this.order;
|
||||
} else {
|
||||
json[r'order'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -69,8 +99,11 @@ class GeoPointDTOCategorie {
|
||||
}());
|
||||
|
||||
return GeoPointDTOCategorie(
|
||||
name: mapValueOfType<String>(json, r'name'),
|
||||
label: TranslationDTO.listFromJson(json[r'label']),
|
||||
icon: mapValueOfType<String>(json, r'icon'),
|
||||
iconResourceId: mapValueOfType<String>(json, r'iconResourceId'),
|
||||
iconUrl: mapValueOfType<String>(json, r'iconUrl'),
|
||||
order: mapValueOfType<int>(json, r'order'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -14,42 +14,21 @@ class LevelDTO {
|
||||
/// Returns a new [LevelDTO] instance.
|
||||
LevelDTO({
|
||||
this.label = const [],
|
||||
this.resourceId,
|
||||
this.resourceType,
|
||||
this.resourceUrl,
|
||||
});
|
||||
|
||||
List<TranslationDTO>? label;
|
||||
|
||||
String? resourceId;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
ResourceType? resourceType;
|
||||
|
||||
String? resourceUrl;
|
||||
List<TranslationAndResourceDTO>? label;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is LevelDTO &&
|
||||
other.label == label &&
|
||||
other.resourceId == resourceId &&
|
||||
other.resourceType == resourceType &&
|
||||
other.resourceUrl == resourceUrl;
|
||||
other.label == label;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(label == null ? 0 : label!.hashCode) +
|
||||
(resourceId == null ? 0 : resourceId!.hashCode) +
|
||||
(resourceType == null ? 0 : resourceType!.hashCode) +
|
||||
(resourceUrl == null ? 0 : resourceUrl!.hashCode);
|
||||
(label == null ? 0 : label!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'LevelDTO[label=$label, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl]';
|
||||
String toString() => 'LevelDTO[label=$label]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -58,21 +37,6 @@ class LevelDTO {
|
||||
} else {
|
||||
json[r'label'] = null;
|
||||
}
|
||||
if (this.resourceId != null) {
|
||||
json[r'resourceId'] = this.resourceId;
|
||||
} else {
|
||||
json[r'resourceId'] = null;
|
||||
}
|
||||
if (this.resourceType != null) {
|
||||
json[r'resourceType'] = this.resourceType;
|
||||
} else {
|
||||
json[r'resourceType'] = null;
|
||||
}
|
||||
if (this.resourceUrl != null) {
|
||||
json[r'resourceUrl'] = this.resourceUrl;
|
||||
} else {
|
||||
json[r'resourceUrl'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -95,10 +59,7 @@ class LevelDTO {
|
||||
}());
|
||||
|
||||
return LevelDTO(
|
||||
label: TranslationDTO.listFromJson(json[r'label']),
|
||||
resourceId: mapValueOfType<String>(json, r'resourceId'),
|
||||
resourceType: ResourceType.fromJson(json[r'resourceType']),
|
||||
resourceUrl: mapValueOfType<String>(json, r'resourceUrl'),
|
||||
label: TranslationAndResourceDTO.listFromJson(json[r'label']),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -18,9 +18,9 @@ class PuzzleDTO {
|
||||
this.image,
|
||||
});
|
||||
|
||||
List<TranslationDTO>? messageDebut;
|
||||
List<TranslationAndResourceDTO>? messageDebut;
|
||||
|
||||
List<TranslationDTO>? messageFin;
|
||||
List<TranslationAndResourceDTO>? messageFin;
|
||||
|
||||
PuzzleDTOImage? image;
|
||||
|
||||
@ -79,8 +79,8 @@ class PuzzleDTO {
|
||||
}());
|
||||
|
||||
return PuzzleDTO(
|
||||
messageDebut: TranslationDTO.listFromJson(json[r'messageDebut']),
|
||||
messageFin: TranslationDTO.listFromJson(json[r'messageFin']),
|
||||
messageDebut: TranslationAndResourceDTO.listFromJson(json[r'messageDebut']),
|
||||
messageFin: TranslationAndResourceDTO.listFromJson(json[r'messageFin']),
|
||||
image: PuzzleDTOImage.fromJson(json[r'image']),
|
||||
);
|
||||
}
|
||||
|
||||
@ -15,17 +15,17 @@ class QuestionDTO {
|
||||
QuestionDTO({
|
||||
this.label = const [],
|
||||
this.responses = const [],
|
||||
this.resourceId,
|
||||
this.resourceType,
|
||||
this.resourceUrl,
|
||||
this.imageBackgroundResourceId,
|
||||
this.imageBackgroundResourceType,
|
||||
this.imageBackgroundResourceUrl,
|
||||
this.order,
|
||||
});
|
||||
|
||||
List<TranslationDTO>? label;
|
||||
List<TranslationAndResourceDTO>? label;
|
||||
|
||||
List<ResponseDTO>? responses;
|
||||
|
||||
String? resourceId;
|
||||
String? imageBackgroundResourceId;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
@ -33,9 +33,9 @@ class QuestionDTO {
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
ResourceType? resourceType;
|
||||
ResourceType? imageBackgroundResourceType;
|
||||
|
||||
String? resourceUrl;
|
||||
String? imageBackgroundResourceUrl;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
@ -49,9 +49,9 @@ class QuestionDTO {
|
||||
bool operator ==(Object other) => identical(this, other) || other is QuestionDTO &&
|
||||
other.label == label &&
|
||||
other.responses == responses &&
|
||||
other.resourceId == resourceId &&
|
||||
other.resourceType == resourceType &&
|
||||
other.resourceUrl == resourceUrl &&
|
||||
other.imageBackgroundResourceId == imageBackgroundResourceId &&
|
||||
other.imageBackgroundResourceType == imageBackgroundResourceType &&
|
||||
other.imageBackgroundResourceUrl == imageBackgroundResourceUrl &&
|
||||
other.order == order;
|
||||
|
||||
@override
|
||||
@ -59,13 +59,13 @@ class QuestionDTO {
|
||||
// ignore: unnecessary_parenthesis
|
||||
(label == null ? 0 : label!.hashCode) +
|
||||
(responses == null ? 0 : responses!.hashCode) +
|
||||
(resourceId == null ? 0 : resourceId!.hashCode) +
|
||||
(resourceType == null ? 0 : resourceType!.hashCode) +
|
||||
(resourceUrl == null ? 0 : resourceUrl!.hashCode) +
|
||||
(imageBackgroundResourceId == null ? 0 : imageBackgroundResourceId!.hashCode) +
|
||||
(imageBackgroundResourceType == null ? 0 : imageBackgroundResourceType!.hashCode) +
|
||||
(imageBackgroundResourceUrl == null ? 0 : imageBackgroundResourceUrl!.hashCode) +
|
||||
(order == null ? 0 : order!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'QuestionDTO[label=$label, responses=$responses, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl, order=$order]';
|
||||
String toString() => 'QuestionDTO[label=$label, responses=$responses, imageBackgroundResourceId=$imageBackgroundResourceId, imageBackgroundResourceType=$imageBackgroundResourceType, imageBackgroundResourceUrl=$imageBackgroundResourceUrl, order=$order]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -79,20 +79,20 @@ class QuestionDTO {
|
||||
} else {
|
||||
json[r'responses'] = null;
|
||||
}
|
||||
if (this.resourceId != null) {
|
||||
json[r'resourceId'] = this.resourceId;
|
||||
if (this.imageBackgroundResourceId != null) {
|
||||
json[r'imageBackgroundResourceId'] = this.imageBackgroundResourceId;
|
||||
} else {
|
||||
json[r'resourceId'] = null;
|
||||
json[r'imageBackgroundResourceId'] = null;
|
||||
}
|
||||
if (this.resourceType != null) {
|
||||
json[r'resourceType'] = this.resourceType;
|
||||
if (this.imageBackgroundResourceType != null) {
|
||||
json[r'imageBackgroundResourceType'] = this.imageBackgroundResourceType;
|
||||
} else {
|
||||
json[r'resourceType'] = null;
|
||||
json[r'imageBackgroundResourceType'] = null;
|
||||
}
|
||||
if (this.resourceUrl != null) {
|
||||
json[r'resourceUrl'] = this.resourceUrl;
|
||||
if (this.imageBackgroundResourceUrl != null) {
|
||||
json[r'imageBackgroundResourceUrl'] = this.imageBackgroundResourceUrl;
|
||||
} else {
|
||||
json[r'resourceUrl'] = null;
|
||||
json[r'imageBackgroundResourceUrl'] = null;
|
||||
}
|
||||
if (this.order != null) {
|
||||
json[r'order'] = this.order;
|
||||
@ -121,11 +121,11 @@ class QuestionDTO {
|
||||
}());
|
||||
|
||||
return QuestionDTO(
|
||||
label: TranslationDTO.listFromJson(json[r'label']),
|
||||
label: TranslationAndResourceDTO.listFromJson(json[r'label']),
|
||||
responses: ResponseDTO.listFromJson(json[r'responses']),
|
||||
resourceId: mapValueOfType<String>(json, r'resourceId'),
|
||||
resourceType: ResourceType.fromJson(json[r'resourceType']),
|
||||
resourceUrl: mapValueOfType<String>(json, r'resourceUrl'),
|
||||
imageBackgroundResourceId: mapValueOfType<String>(json, r'imageBackgroundResourceId'),
|
||||
imageBackgroundResourceType: ResourceType.fromJson(json[r'imageBackgroundResourceType']),
|
||||
imageBackgroundResourceUrl: mapValueOfType<String>(json, r'imageBackgroundResourceUrl'),
|
||||
order: mapValueOfType<int>(json, r'order'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -14,42 +14,21 @@ class QuizzDTOBadLevel {
|
||||
/// Returns a new [QuizzDTOBadLevel] instance.
|
||||
QuizzDTOBadLevel({
|
||||
this.label = const [],
|
||||
this.resourceId,
|
||||
this.resourceType,
|
||||
this.resourceUrl,
|
||||
});
|
||||
|
||||
List<TranslationDTO>? label;
|
||||
|
||||
String? resourceId;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
ResourceType? resourceType;
|
||||
|
||||
String? resourceUrl;
|
||||
List<TranslationAndResourceDTO>? label;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is QuizzDTOBadLevel &&
|
||||
other.label == label &&
|
||||
other.resourceId == resourceId &&
|
||||
other.resourceType == resourceType &&
|
||||
other.resourceUrl == resourceUrl;
|
||||
other.label == label;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(label == null ? 0 : label!.hashCode) +
|
||||
(resourceId == null ? 0 : resourceId!.hashCode) +
|
||||
(resourceType == null ? 0 : resourceType!.hashCode) +
|
||||
(resourceUrl == null ? 0 : resourceUrl!.hashCode);
|
||||
(label == null ? 0 : label!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'QuizzDTOBadLevel[label=$label, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl]';
|
||||
String toString() => 'QuizzDTOBadLevel[label=$label]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -58,21 +37,6 @@ class QuizzDTOBadLevel {
|
||||
} else {
|
||||
json[r'label'] = null;
|
||||
}
|
||||
if (this.resourceId != null) {
|
||||
json[r'resourceId'] = this.resourceId;
|
||||
} else {
|
||||
json[r'resourceId'] = null;
|
||||
}
|
||||
if (this.resourceType != null) {
|
||||
json[r'resourceType'] = this.resourceType;
|
||||
} else {
|
||||
json[r'resourceType'] = null;
|
||||
}
|
||||
if (this.resourceUrl != null) {
|
||||
json[r'resourceUrl'] = this.resourceUrl;
|
||||
} else {
|
||||
json[r'resourceUrl'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -95,10 +59,7 @@ class QuizzDTOBadLevel {
|
||||
}());
|
||||
|
||||
return QuizzDTOBadLevel(
|
||||
label: TranslationDTO.listFromJson(json[r'label']),
|
||||
resourceId: mapValueOfType<String>(json, r'resourceId'),
|
||||
resourceType: ResourceType.fromJson(json[r'resourceType']),
|
||||
resourceUrl: mapValueOfType<String>(json, r'resourceUrl'),
|
||||
label: TranslationAndResourceDTO.listFromJson(json[r'label']),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -15,13 +15,10 @@ class ResponseDTO {
|
||||
ResponseDTO({
|
||||
this.label = const [],
|
||||
this.isGood,
|
||||
this.resourceId,
|
||||
this.resourceType,
|
||||
this.resourceUrl,
|
||||
this.order,
|
||||
});
|
||||
|
||||
List<TranslationDTO>? label;
|
||||
List<TranslationAndResourceDTO>? label;
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
@ -31,18 +28,6 @@ class ResponseDTO {
|
||||
///
|
||||
bool? isGood;
|
||||
|
||||
String? resourceId;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
ResourceType? resourceType;
|
||||
|
||||
String? resourceUrl;
|
||||
|
||||
///
|
||||
/// 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
|
||||
@ -55,9 +40,6 @@ class ResponseDTO {
|
||||
bool operator ==(Object other) => identical(this, other) || other is ResponseDTO &&
|
||||
other.label == label &&
|
||||
other.isGood == isGood &&
|
||||
other.resourceId == resourceId &&
|
||||
other.resourceType == resourceType &&
|
||||
other.resourceUrl == resourceUrl &&
|
||||
other.order == order;
|
||||
|
||||
@override
|
||||
@ -65,13 +47,10 @@ class ResponseDTO {
|
||||
// ignore: unnecessary_parenthesis
|
||||
(label == null ? 0 : label!.hashCode) +
|
||||
(isGood == null ? 0 : isGood!.hashCode) +
|
||||
(resourceId == null ? 0 : resourceId!.hashCode) +
|
||||
(resourceType == null ? 0 : resourceType!.hashCode) +
|
||||
(resourceUrl == null ? 0 : resourceUrl!.hashCode) +
|
||||
(order == null ? 0 : order!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ResponseDTO[label=$label, isGood=$isGood, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl, order=$order]';
|
||||
String toString() => 'ResponseDTO[label=$label, isGood=$isGood, order=$order]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -85,21 +64,6 @@ class ResponseDTO {
|
||||
} else {
|
||||
json[r'isGood'] = null;
|
||||
}
|
||||
if (this.resourceId != null) {
|
||||
json[r'resourceId'] = this.resourceId;
|
||||
} else {
|
||||
json[r'resourceId'] = null;
|
||||
}
|
||||
if (this.resourceType != null) {
|
||||
json[r'resourceType'] = this.resourceType;
|
||||
} else {
|
||||
json[r'resourceType'] = null;
|
||||
}
|
||||
if (this.resourceUrl != null) {
|
||||
json[r'resourceUrl'] = this.resourceUrl;
|
||||
} else {
|
||||
json[r'resourceUrl'] = null;
|
||||
}
|
||||
if (this.order != null) {
|
||||
json[r'order'] = this.order;
|
||||
} else {
|
||||
@ -127,11 +91,8 @@ class ResponseDTO {
|
||||
}());
|
||||
|
||||
return ResponseDTO(
|
||||
label: TranslationDTO.listFromJson(json[r'label']),
|
||||
label: TranslationAndResourceDTO.listFromJson(json[r'label']),
|
||||
isGood: mapValueOfType<bool>(json, r'isGood'),
|
||||
resourceId: mapValueOfType<String>(json, r'resourceId'),
|
||||
resourceType: ResourceType.fromJson(json[r'resourceType']),
|
||||
resourceUrl: mapValueOfType<String>(json, r'resourceUrl'),
|
||||
order: mapValueOfType<int>(json, r'order'),
|
||||
);
|
||||
}
|
||||
|
||||
162
manager_api_new/lib/model/translation_and_resource_dto.dart
Normal file
162
manager_api_new/lib/model/translation_and_resource_dto.dart
Normal file
@ -0,0 +1,162 @@
|
||||
//
|
||||
// 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 TranslationAndResourceDTO {
|
||||
/// Returns a new [TranslationAndResourceDTO] instance.
|
||||
TranslationAndResourceDTO({
|
||||
this.language,
|
||||
this.value,
|
||||
this.resourceId,
|
||||
this.resourceType,
|
||||
this.resourceUrl,
|
||||
});
|
||||
|
||||
String? language;
|
||||
|
||||
String? value;
|
||||
|
||||
String? resourceId;
|
||||
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
ResourceType? resourceType;
|
||||
|
||||
String? resourceUrl;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is TranslationAndResourceDTO &&
|
||||
other.language == language &&
|
||||
other.value == value &&
|
||||
other.resourceId == resourceId &&
|
||||
other.resourceType == resourceType &&
|
||||
other.resourceUrl == resourceUrl;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(language == null ? 0 : language!.hashCode) +
|
||||
(value == null ? 0 : value!.hashCode) +
|
||||
(resourceId == null ? 0 : resourceId!.hashCode) +
|
||||
(resourceType == null ? 0 : resourceType!.hashCode) +
|
||||
(resourceUrl == null ? 0 : resourceUrl!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'TranslationAndResourceDTO[language=$language, value=$value, resourceId=$resourceId, resourceType=$resourceType, resourceUrl=$resourceUrl]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.language != null) {
|
||||
json[r'language'] = this.language;
|
||||
} else {
|
||||
json[r'language'] = null;
|
||||
}
|
||||
if (this.value != null) {
|
||||
json[r'value'] = this.value;
|
||||
} else {
|
||||
json[r'value'] = null;
|
||||
}
|
||||
if (this.resourceId != null) {
|
||||
json[r'resourceId'] = this.resourceId;
|
||||
} else {
|
||||
json[r'resourceId'] = null;
|
||||
}
|
||||
if (this.resourceType != null) {
|
||||
json[r'resourceType'] = this.resourceType;
|
||||
} else {
|
||||
json[r'resourceType'] = null;
|
||||
}
|
||||
if (this.resourceUrl != null) {
|
||||
json[r'resourceUrl'] = this.resourceUrl;
|
||||
} else {
|
||||
json[r'resourceUrl'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [TranslationAndResourceDTO] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static TranslationAndResourceDTO? 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 "TranslationAndResourceDTO[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "TranslationAndResourceDTO[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return TranslationAndResourceDTO(
|
||||
language: mapValueOfType<String>(json, r'language'),
|
||||
value: mapValueOfType<String>(json, r'value'),
|
||||
resourceId: mapValueOfType<String>(json, r'resourceId'),
|
||||
resourceType: ResourceType.fromJson(json[r'resourceType']),
|
||||
resourceUrl: mapValueOfType<String>(json, r'resourceUrl'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<TranslationAndResourceDTO> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <TranslationAndResourceDTO>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = TranslationAndResourceDTO.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, TranslationAndResourceDTO> mapFromJson(dynamic json) {
|
||||
final map = <String, TranslationAndResourceDTO>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = TranslationAndResourceDTO.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of TranslationAndResourceDTO-objects as value to a dart map
|
||||
static Map<String, List<TranslationAndResourceDTO>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<TranslationAndResourceDTO>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = TranslationAndResourceDTO.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
}
|
||||
|
||||
47
manager_api_new/test/translation_and_resource_dto_test.dart
Normal file
47
manager_api_new/test/translation_and_resource_dto_test.dart
Normal file
@ -0,0 +1,47 @@
|
||||
//
|
||||
// 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 TranslationAndResourceDTO
|
||||
void main() {
|
||||
// final instance = TranslationAndResourceDTO();
|
||||
|
||||
group('test TranslationAndResourceDTO', () {
|
||||
// String language
|
||||
test('to test the property `language`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String value
|
||||
test('to test the property `value`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String resourceId
|
||||
test('to test the property `resourceId`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// ResourceType resourceType
|
||||
test('to test the property `resourceType`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
// String resourceUrl
|
||||
test('to test the property `resourceUrl`', () async {
|
||||
// TODO
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user