Add Quizz handle !

This commit is contained in:
Fransolet Thomas 2022-03-19 01:18:27 +01:00
parent cf1eccc83e
commit 358a035408
47 changed files with 6910 additions and 1846 deletions

View File

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart'; import 'package:flutter_colorpicker/flutter_colorpicker.dart';
import 'package:manager_app/Components/rounded_button.dart'; import 'package:manager_app/Components/rounded_button.dart';
import '../constants.dart';
showColorPicker (Color currentColor, Function onSelect, BuildContext context) { showColorPicker (Color currentColor, Function onSelect, BuildContext context) {
Color pickerColor = currentColor; Color pickerColor = currentColor;
@ -39,7 +41,7 @@ showColorPicker (Color currentColor, Function onSelect, BuildContext context) {
child: RoundedButton( child: RoundedButton(
text: "Valider", text: "Valider",
icon: Icons.check, icon: Icons.check,
color: Colors.lightGreen, color: kSuccess,
press: () { press: () {
onSelect(pickerColor); onSelect(pickerColor);
Navigator.of(context).pop(); Navigator.of(context).pop();

View File

@ -18,6 +18,9 @@ IconData getSectionIcon(elementType) {
case SectionType.menu: case SectionType.menu:
return Icons.apps_sharp; return Icons.apps_sharp;
break; break;
case SectionType.quizz:
return Icons.question_answer;
break;
} }
return Icons.menu; return Icons.menu;
} }

View File

@ -10,12 +10,17 @@ showNotification (Color backgroundColor, Color textColor, String text, BuildCont
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
), ),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 8.0, // Inner padding for SnackBar content. horizontal: 10.0, // Inner padding for SnackBar content.
), ),
content: Text( content: Container(
text, height: 32.5,
textAlign: TextAlign.center, child: Center(
style: TextStyle(color: textColor), child: Text(
text,
textAlign: TextAlign.center,
style: TextStyle(color: textColor),
),
),
) )
); );
ScaffoldMessenger.of(context).showSnackBar(snackBar); ScaffoldMessenger.of(context).showSnackBar(snackBar);

View File

@ -7,6 +7,8 @@ class RoundedButton extends StatelessWidget {
final IconData icon; final IconData icon;
final Color color, textColor; final Color color, textColor;
final double fontSize; final double fontSize;
final int vertical;
final int horizontal;
const RoundedButton({ const RoundedButton({
Key key, Key key,
@ -15,7 +17,9 @@ class RoundedButton extends StatelessWidget {
this.icon, this.icon,
this.color = kPrimaryColor, this.color = kPrimaryColor,
this.textColor = kWhite, this.textColor = kWhite,
this.fontSize this.fontSize,
this.vertical,
this.horizontal
}) : super(key: key); }) : super(key: key);
@override @override
@ -23,7 +27,7 @@ class RoundedButton extends StatelessWidget {
//Size size = MediaQuery.of(context).size; //Size size = MediaQuery.of(context).size;
return TextButton( return TextButton(
style: ButtonStyle( style: ButtonStyle(
padding: MaterialStateProperty.resolveWith((states) => EdgeInsets.symmetric(vertical: 25, horizontal: icon == null ? 85 : 30)), padding: MaterialStateProperty.resolveWith((states) => EdgeInsets.symmetric(vertical: this.vertical != null ? this.vertical : 25, horizontal: this.horizontal != null ? this.horizontal : (icon == null ? 85 : 30))),
backgroundColor: MaterialStateColor.resolveWith((states) => color), backgroundColor: MaterialStateColor.resolveWith((states) => color),
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(

View File

@ -115,7 +115,7 @@ class _GeoPointImageListState extends State<GeoPointImageList> {
size: 30.0, size: 30.0,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.lightGreen, color: kSuccess,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(20.0), borderRadius: BorderRadius.circular(20.0),
boxShadow: [ boxShadow: [

View File

@ -159,7 +159,7 @@ class _MapConfigState extends State<MapConfig> {
size: 30.0, size: 30.0,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.lightGreen, color: kSuccess,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(20.0), borderRadius: BorderRadius.circular(20.0),
boxShadow: [ boxShadow: [

View File

@ -130,7 +130,7 @@ class _MenuConfigState extends State<MenuConfig> {
size: 30.0, size: 30.0,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.lightGreen, color: kSuccess,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(20.0), borderRadius: BorderRadius.circular(20.0),
boxShadow: [ boxShadow: [

View File

@ -0,0 +1,201 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:manager_app/Components/image_input_container.dart';
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/text_form_input_container.dart';
import 'package:manager_app/Models/managerContext.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/Quizz/quizz_answer_list.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:managerapi/api.dart';
Future<QuestionDTO> showNewOrUpdateQuestionQuizz(QuestionDTO inputQuestionDTO, AppContext appContext, BuildContext context, String text) async {
QuestionDTO questionDTO = new QuestionDTO();
if (inputQuestionDTO != null) {
questionDTO = inputQuestionDTO;
} else {
questionDTO.label = <TranslationDTO>[];
ManagerAppContext managerAppContext = appContext.getContext();
managerAppContext.selectedConfiguration.languages.forEach((element) {
var translationMessageDTO = new TranslationDTO();
translationMessageDTO.language = element;
translationMessageDTO.value = "";
questionDTO.label.add(translationMessageDTO);
});
}
if(questionDTO.responses == null) {
questionDTO.responses = <ResponseDTO>[];
}
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)),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: ImageInputContainer(
label: "Image :",
initialValue: questionDTO.resourceId,
color: kPrimaryColor,
onChanged: (ResourceDTO resource) {
var result = resource;
questionDTO.source_ = result.type == ResourceType.imageUrl ? result.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ result.id;
questionDTO.resourceId = result.id;
},
isSmall: true
),
),
Container(
//color: Colors.orangeAccent,
height: size.height * 0.15,
width: double.infinity,
child: ListView(
scrollDirection: Axis.horizontal,
children: getTranslations(dialogContext, appContext, questionDTO),
),
),
Container(
height: size.height * 0.33,
decoration: BoxDecoration(
color: kWhite,
//color: Colors.green,
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
),
],
),
child: QuizzResponseList(
responses: questionDTO.responses,
onChanged: (List<ResponseDTO> responsesOutput) {
questionDTO.responses = responsesOutput;
},
),
),
],
),
],
),
),
),
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: inputQuestionDTO != null ? 220: 150,
height: 70,
child: RoundedButton(
text: inputQuestionDTO != null ? "Sauvegarder" : "Créer",
icon: Icons.check,
color: kPrimaryColor,
textColor: kWhite,
press: () {
if(!questionDTO.label.any((label) => label.value == null || label.value.trim() == "")) {
Navigator.pop(dialogContext, questionDTO);
} else {
showNotification(kPrimaryColor, kWhite, "La traduction n'est pas complète", context, null);
}
},
fontSize: 20,
),
),
),
],
),
],
), context: context
);
return result;
}
getTranslations(BuildContext context, AppContext appContext, QuestionDTO questionDTO) {
List<Widget> translations = <Widget>[];
ManagerAppContext managerAppContext = appContext.getContext();
for(var language in managerAppContext.selectedConfiguration.languages) {
translations.add(
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width *0.05,
height: MediaQuery.of(context).size.height *0.2,
decoration: BoxDecoration(
border: Border(
right: BorderSide(width: 1.5, color: kSecond),
),
),
child: Center(child: AutoSizeText(language.toUpperCase()))
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Container(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextFormInputContainer(
label: "Question:",
color: kWhite,
isTitle: false,
initialValue: questionDTO.label.where((element) => element.language == language).first.value,
onChanged: (value) {
questionDTO.label.where((element) => element.language == language).first.value = value;
},
),
],
),
),
),
)
],
),
)
);
}
return translations;
}

View File

@ -0,0 +1,178 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:manager_app/Components/image_input_container.dart';
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/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:managerapi/api.dart';
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>[];
ManagerAppContext managerAppContext = appContext.getContext();
managerAppContext.selectedConfiguration.languages.forEach((element) {
var translationMessageDTO = new TranslationDTO();
translationMessageDTO.language = element;
translationMessageDTO.value = "";
responseDTO.label.add(translationMessageDTO);
});
}
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)),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
height: size.height * 0.25,
width: double.infinity,
child: ListView(
scrollDirection: Axis.horizontal,
children: getTranslations(dialogContext, appContext, responseDTO),
),
),
],
),
/*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;
},
),
),
],
),*/
],
),
),
),
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: inputResponseDTO != null ? 220: 150,
height: 70,
child: RoundedButton(
text: inputResponseDTO != null ? "Sauvegarder" : "Créer",
icon: Icons.check,
color: kPrimaryColor,
textColor: kWhite,
press: () {
if(!responseDTO.label.any((label) => label.value == null || label.value.trim() == "")) {
Navigator.pop(dialogContext, responseDTO);
} else {
showNotification(kPrimaryColor, kWhite, "La traduction n'est pas complète", context, null);
}
},
fontSize: 20,
),
),
),
],
),
],
), context: context
);
return result;
}
getTranslations(BuildContext context, AppContext appContext, ResponseDTO responseDTO) {
List<Widget> translations = <Widget>[];
ManagerAppContext managerAppContext = appContext.getContext();
for(var language in managerAppContext.selectedConfiguration.languages) {
translations.add(
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width *0.05,
height: MediaQuery.of(context).size.height *0.2,
decoration: BoxDecoration(
border: Border(
right: BorderSide(width: 1.5, color: kSecond),
),
),
child: Center(child: AutoSizeText(language.toUpperCase()))
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Container(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextFormInputContainer(
label: "Réponse:",
color: kWhite,
isTitle: true,
initialValue: responseDTO.label.where((element) => element.language == language).first.value,
onChanged: (value) {
responseDTO.label.where((element) => element.language == language).first.value = value;
},
),
],
),
),
),
)
],
),
)
);
}
return translations;
}

View File

@ -0,0 +1,166 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:manager_app/Components/image_input_container.dart';
import 'package:flutter/material.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:managerapi/api.dart';
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>[];
ManagerAppContext managerAppContext = appContext.getContext();
managerAppContext.selectedConfiguration.languages.forEach((element) {
var translationMessageDTO = new TranslationDTO();
translationMessageDTO.language = element;
translationMessageDTO.value = "";
levelDTO.label.add(translationMessageDTO);
});
}
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)),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: ImageInputContainer(
label: "Image :",
initialValue: levelDTO.resourceId,
color: kPrimaryColor,
onChanged: (ResourceDTO resource) {
var result = resource;
levelDTO.source_ = result.type == ResourceType.imageUrl ? result.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ result.id;
levelDTO.resourceId = result.id;
},
isSmall: true
),
),
Container(
height: size.height * 0.33,
width: double.infinity,
child: ListView(
scrollDirection: Axis.horizontal,
children: getTranslations(dialogContext, appContext, levelDTO),
),
),
],
),
],
),
),
),
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: inputLevelDTO != null ? 220: 150,
height: 70,
child: RoundedButton(
text: inputLevelDTO != null ? "Sauvegarder" : "Créer",
icon: Icons.check,
color: kPrimaryColor,
textColor: kWhite,
press: () {
Navigator.pop(dialogContext, levelDTO);
},
fontSize: 20,
),
),
),
],
),
],
), context: context
);
return result;
}
getTranslations(BuildContext context, AppContext appContext, LevelDTO levelDTO) {
List<Widget> translations = <Widget>[];
ManagerAppContext managerAppContext = appContext.getContext();
for(var language in managerAppContext.selectedConfiguration.languages) {
translations.add(
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
width: MediaQuery.of(context).size.width *0.05,
height: MediaQuery.of(context).size.height *0.2,
decoration: BoxDecoration(
border: Border(
right: BorderSide(width: 1.5, color: kSecond),
),
),
child: Center(child: AutoSizeText(language.toUpperCase()))
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Container(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextFormInputContainer(
label: "Message:",
color: kWhite,
isTitle: false,
initialValue: levelDTO.label.where((element) => element.language == language).first.value,
onChanged: (value) {
levelDTO.label.where((element) => element.language == language).first.value = value;
},
),
],
),
),
),
)
],
),
)
);
}
return translations;
}

View File

@ -0,0 +1,244 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:managerapi/api.dart';
import 'package:provider/provider.dart';
import 'new_update_response_quizz.dart';
class QuizzResponseList extends StatefulWidget {
final List<ResponseDTO> responses;
final ValueChanged<List<ResponseDTO>> onChanged;
const QuizzResponseList({
Key key,
this.responses,
this.onChanged,
}) : super(key: key);
@override
_QuizzResponseListState createState() => _QuizzResponseListState();
}
class _QuizzResponseListState extends State<QuizzResponseList> {
List<ResponseDTO> responsesMiddle;
@override
void initState() {
super.initState();
responsesMiddle = new List<ResponseDTO>.from(widget.responses);
}
void _onReorder(int oldIndex, int newIndex) {
setState(
() {
if (newIndex > oldIndex) {
newIndex -= 1;
}
final ResponseDTO item = responsesMiddle.removeAt(oldIndex);
responsesMiddle.insert(newIndex, item);
var i = 0;
responsesMiddle.forEach((response) {
response.order = i;
i++;
});
widget.onChanged(responsesMiddle);
},
);
}
@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, responsesMiddle[index], size, appContext),
);
},
itemCount: responsesMiddle.length,
onReorder: _onReorder
),
),
Positioned(
top: 10,
left: 10,
child: Text(
"Réponses",
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500),
),
),
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);
});
}
},
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, ResponseDTO response, Size size, AppContext appContext) {
return Stack(
children: [
Container(
width: size.width *0.8,
height: 50,
child: Row(
children: [
Center(
child: Padding(
padding: const EdgeInsets.all(2.0),
child: AutoSizeText(
response.label == null ? "" : response.label[0].value,
style: new TextStyle(fontSize: 15),
maxLines: 2,
textAlign: TextAlign.center,
),
),
),
],
),
),
Positioned(
right: 35,
bottom: 3,
child: Row(
children: [
Tooltip(
message: "Si coché, la réponse est valide",
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Checkbox(
value: response.isGood,
checkColor: Colors.white,
activeColor: kPrimaryColor,
onChanged: (bool value) {
setState(() {
response.isGood = !response.isGood;
widget.onChanged(responsesMiddle);
});
},
),
),
),
Tooltip(
message: "Modifier",
child: InkWell(
onTap: () async {
var result = await showNewOrUpdateResponseQuizz(
response,
appContext,
context,
"Modifier la réponse"
);
if (result != null) {
setState(() {
responsesMiddle[response.order] = result;
widget.onChanged(responsesMiddle);
});
}
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.edit,
color: kPrimaryColor,
size: 25.0,
),
)
),
),
Tooltip(
message: "Supprimer",
child: InkWell(
onTap: () {
setState(() {
responsesMiddle.removeAt(response.order);
widget.onChanged(responsesMiddle);
});
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.delete,
color: kPrimaryColor,
size: 25.0,
),
)
),
),
],
)
),
],
);
}
}
boxDecoration() {
return BoxDecoration(
color: kBackgroundColor,
shape: BoxShape.rectangle,
border: Border.all(width: 1.5, color: kSecond),
borderRadius: BorderRadius.circular(10.0),
boxShadow: [
BoxShadow(
color: kSecond,
spreadRadius: 0.5,
blurRadius: 5,
offset: Offset(0, 1.5), // changes position of shadow
),
],
);
}

View File

@ -0,0 +1,380 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/rounded_button.dart';
import 'package:manager_app/app_context.dart';
import 'package:manager_app/constants.dart';
import 'package:managerapi/api.dart';
import 'dart:convert';
import 'package:provider/provider.dart';
import 'new_update_question_quizz.dart';
import 'new_update_score_quizz.dart';
class QuizzConfig extends StatefulWidget {
final String color;
final String label;
final String initialValue;
final ValueChanged<String> onChanged;
const QuizzConfig({
Key key,
this.color,
this.label,
this.initialValue,
this.onChanged,
}) : super(key: key);
@override
_QuizzConfigState createState() => _QuizzConfigState();
}
class _QuizzConfigState extends State<QuizzConfig> {
QuizzDTO quizzDTO;
@override
void initState() {
super.initState();
quizzDTO = QuizzDTO.fromJson(json.decode(widget.initialValue));
List<QuestionDTO> test = new List<QuestionDTO>.from(quizzDTO.questions);
quizzDTO.questions = test;
quizzDTO.questions.sort((a, b) => a.order.compareTo(b.order));
}
@override
Widget build(BuildContext context) {
final appContext = Provider.of<AppContext>(context);
Size size = MediaQuery.of(context).size;
void _onReorder(int oldIndex, int newIndex) {
setState(
() {
if (newIndex > oldIndex) {
newIndex -= 1;
}
final QuestionDTO item = quizzDTO.questions.removeAt(oldIndex);
quizzDTO.questions.insert(newIndex, item);
var i = 0;
quizzDTO.questions.forEach((question) {
question.order = i;
i++;
});
widget.onChanged(jsonEncode(quizzDTO).toString());
},
);
}
return
SingleChildScrollView(
child: Column(
children: [
Container(
height: size.height * 0.1,
width: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
// Bad
Container(
height: 50,
child: RoundedButton(
text: "Mauvais score",
color: kPrimaryColor,
textColor: kWhite,
icon: Icons.message,
press: () async {
var result = await showNewOrUpdateScoreQuizz(quizzDTO.badLevel, appContext, context, "Message pour un mauvais score");
if (result != null)
{
setState(() {
print("BAAAD");
quizzDTO.badLevel = result;
print(quizzDTO.badLevel);
widget.onChanged(jsonEncode(quizzDTO).toString());
});
}
},
fontSize: 20,
horizontal: 10,
vertical: 10
),
),
// Medium
Container(
height: 50,
child: RoundedButton(
text: "Moyen score",
color: kPrimaryColor,
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());
});
}
},
fontSize: 20,
horizontal: 10,
vertical: 10
),
),
// Good
Container(
height: 50,
child: RoundedButton(
text: "Bon score",
color: kPrimaryColor,
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());
});
}
},
fontSize: 20,
horizontal: 10,
vertical: 10
),
),
// Great
Container(
height: 50,
child: RoundedButton(
text: "Excellent score",
color: kPrimaryColor,
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());
});
}
},
fontSize: 20,
horizontal: 10,
vertical: 10
),
),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
border: Border.all(width: 1.5, color: kSecond)
),
child: Stack(
children: [
Padding(
padding: const EdgeInsets.only(top: 40, left: 10, right: 10, bottom: 10),
child: Container(
height: quizzDTO.questions.length == 0 ? 75 : null,
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, quizzDTO.questions[index], size, appContext),
);
},
itemCount: quizzDTO.questions.length,
onReorder: _onReorder
),
)
),
Positioned(
top: 10,
left: 10,
child: Text(
"Questions",
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500),
),
),
Positioned(
bottom: 10,
right: 10,
child: InkWell(
onTap: () async {
print("new question");
QuestionDTO result = await showNewOrUpdateQuestionQuizz(null, appContext, context, "Question");
if (result != null)
{
setState(() {
result.order = quizzDTO.questions.length;
quizzDTO.questions.add(result);
widget.onChanged(jsonEncode(quizzDTO).toString());
});
}
},
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, QuestionDTO question, Size size, AppContext appContext) {
return Stack(
children: [
Container(
width: size.width *0.8,
height: 75,
child: Row(
children: [
if(question.source_ != null) Container(
height: 60,
width: 60,
decoration: imageBoxDecoration(question, appContext),
margin: EdgeInsets.symmetric(horizontal: 10),
),
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,
),
),
),
],
),
),
Positioned(
right: 35,
bottom: 18,
child: Row(
children: [
Tooltip(
message: "Modifier",
child: InkWell(
onTap: () async {
var result = await showNewOrUpdateQuestionQuizz(
question,
appContext,
context,
"Modifier la question"
);
if (result != null) {
setState(() {
quizzDTO.questions[question.order] = result;
widget.onChanged(jsonEncode(quizzDTO).toString());
});
}
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.edit,
color: kPrimaryColor,
size: 25.0,
),
)
),
),
Tooltip(
message: "Supprimer",
child: InkWell(
onTap: () {
setState(() {
quizzDTO.questions.removeAt(question.order);
widget.onChanged(jsonEncode(quizzDTO).toString());
});
},
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.delete,
color: kPrimaryColor,
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(QuestionDTO questionDTO, appContext) {
return BoxDecoration(
color: kBackgroundColor,
shape: BoxShape.rectangle,
border: Border.all(width: 1.5, color: kSecond),
borderRadius: BorderRadius.circular(10.0),
image: questionDTO.source_ != null ? new DecorationImage(
fit: BoxFit.cover,
image: new NetworkImage(
questionDTO.source_,
),
) : null,
);
}

View File

@ -117,7 +117,7 @@ class _SliderConfigState extends State<SliderConfig> {
size: 30.0, size: 30.0,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.lightGreen, color: kSuccess,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(20.0), borderRadius: BorderRadius.circular(20.0),
boxShadow: [ boxShadow: [

View File

@ -18,6 +18,7 @@ import 'package:intl/intl.dart';
import 'SubSection/Map/map_config.dart'; import 'SubSection/Map/map_config.dart';
import 'SubSection/Menu/menu_config.dart'; import 'SubSection/Menu/menu_config.dart';
import 'SubSection/Quizz/quizz_config.dart';
import 'SubSection/Slider/slider_config.dart'; import 'SubSection/Slider/slider_config.dart';
class SectionDetailScreen extends StatefulWidget { class SectionDetailScreen extends StatefulWidget {
@ -67,17 +68,18 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
Widget bodySection(SectionDTO sectionDTO, Size size, AppContext appContext, BuildContext context) { Widget bodySection(SectionDTO sectionDTO, Size size, AppContext appContext, BuildContext context) {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, //mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Container( Container(
//height: size.height *0.13, //color: Colors.orangeAccent,
height: 75,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Align( Align(
alignment: AlignmentDirectional.bottomStart, alignment: AlignmentDirectional.bottomStart,
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(3.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@ -104,7 +106,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
) )
), ),
Padding( Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(5.0),
child: Align( child: Align(
alignment: AlignmentDirectional.centerEnd, alignment: AlignmentDirectional.centerEnd,
child: InkWell( child: InkWell(
@ -127,8 +129,9 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
), ),
), // TITLE ), // TITLE
Container( Container(
//color: Colors.blue,
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(5.0),
child: Container( child: Container(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -201,19 +204,20 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
), ),
),// FIELDS SECTION ),// FIELDS SECTION
Container( Container(
height: size.height * 0.305,
//width: size.width * 0.8, //width: size.width * 0.8,
height: size.height * 0.45,
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: sectionDTO != null ? getSpecificData(sectionDTO, appContext) : null, child: sectionDTO != null ? getSpecificData(sectionDTO, appContext) : null,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
//color: Colors.lightGreen,
borderRadius: BorderRadius.circular(30), borderRadius: BorderRadius.circular(30),
border: Border.all(width: 1.5, color: kSecond) border: Border.all(width: 1.5, color: kSecond)
), ),
), ),
SizedBox( SizedBox(
height: size.height*0.1, height: size.height*0.05,
) )
], ],
); );
@ -257,7 +261,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
child: RoundedButton( child: RoundedButton(
text: "Sauvegarder", text: "Sauvegarder",
icon: Icons.done, icon: Icons.done,
color: Colors.lightGreen, color: kSuccess,
textColor: Colors.white, textColor: Colors.white,
fontSize: 15, fontSize: 15,
press: () { press: () {
@ -342,6 +346,15 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
sectionDTO.data = data; sectionDTO.data = data;
}, },
); );
case SectionType.quizz:
return QuizzConfig(
initialValue: sectionDTO.data,
onChanged: (String data) {
print("Received info in parent - quizz");
print(data);
sectionDTO.data = data;
},
);
} }
} }
} }

View File

@ -257,7 +257,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
child: RoundedButton( child: RoundedButton(
text: "Supprimer", text: "Supprimer",
icon: Icons.delete, icon: Icons.delete,
color: Colors.red, color: kPrimaryColor,
textColor: Colors.white, textColor: Colors.white,
fontSize: 15, fontSize: 15,
press: () { press: () {
@ -270,7 +270,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
child: RoundedButton( child: RoundedButton(
text: "Sauvegarder", text: "Sauvegarder",
icon: Icons.done, icon: Icons.done,
color: Colors.lightGreen, color: kSuccess,
textColor: Colors.white, textColor: Colors.white,
fontSize: 15, fontSize: 15,
press: () { press: () {
@ -349,7 +349,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
boxDecoration(dynamic element) { boxDecoration(dynamic element) {
return BoxDecoration( return BoxDecoration(
color: element.id == null ? Colors.lightGreen : kTextLightColor, color: element.id == null ? kSuccess : kTextLightColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(25.0), borderRadius: BorderRadius.circular(25.0),
boxShadow: [ boxShadow: [

View File

@ -144,7 +144,7 @@ Future<List<ConfigurationDTO>> getConfigurations(dynamic appContext) async {
boxDecoration(ConfigurationDTO configurationDTO) { boxDecoration(ConfigurationDTO configurationDTO) {
return BoxDecoration( return BoxDecoration(
color: configurationDTO.id == null ? Colors.lightGreen : kTextLightColor, color: configurationDTO.id == null ? kSuccess : kTextLightColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(25.0), borderRadius: BorderRadius.circular(25.0),
boxShadow: [ boxShadow: [

View File

@ -109,7 +109,7 @@ class _SectionReorderListState extends State<SectionReorderList> {
size: 30.0, size: 30.0,
), ),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.lightGreen, color: kSuccess,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(20.0), borderRadius: BorderRadius.circular(20.0),
boxShadow: [ boxShadow: [

View File

@ -91,7 +91,7 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
height: size.height *0.08, height: size.height *0.08,
width: size.height *0.08, width: size.height *0.08,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.lightGreen, color: kSuccess,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(25.0), borderRadius: BorderRadius.circular(25.0),
boxShadow: [ boxShadow: [
@ -211,7 +211,7 @@ class _ResourceBodyGridState extends State<ResourceBodyGrid> {
boxDecoration(dynamic resourceDetailDTO, appContext) { boxDecoration(dynamic resourceDetailDTO, appContext) {
return BoxDecoration( return BoxDecoration(
color: resourceDetailDTO.id == null ? Colors.lightGreen : kBackgroundColor, color: resourceDetailDTO.id == null ? kSuccess : kBackgroundColor,
shape: BoxShape.rectangle, shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(30.0), borderRadius: BorderRadius.circular(30.0),
image: resourceDetailDTO.id != null && resourceDetailDTO.type != ResourceType.videoUrl ? new DecorationImage( image: resourceDetailDTO.id != null && resourceDetailDTO.type != ResourceType.videoUrl ? new DecorationImage(

View File

@ -60,7 +60,7 @@ class _LoginScreenState extends State<LoginScreen> {
FileHelper().writeSession(updatedSession); FileHelper().writeSession(updatedSession);
} }
showNotification(Colors.lightGreen, kWhite, 'Connexion réussie', context, null); showNotification(kSuccess, kWhite, 'Connexion réussie', context, null);
ManagerAppContext managerAppContext = appContext.getContext(); ManagerAppContext managerAppContext = appContext.getContext();
// Set the appContext // Set the appContext
@ -176,15 +176,17 @@ class _LoginScreenState extends State<LoginScreen> {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Checkbox( Container(
checkColor: kTextLightColor, child: Checkbox(
activeColor: kPrimaryColor, checkColor: kTextLightColor,
value: this.isRememberMe, activeColor: kPrimaryColor,
onChanged: (bool value) { value: this.isRememberMe,
setState(() { onChanged: (bool value) {
this.isRememberMe = value; setState(() {
}); this.isRememberMe = value;
}, });
},
),
), ),
Text("Se souvenir de moi", style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500),), Text("Se souvenir de moi", style: TextStyle(fontSize: 15, fontWeight: FontWeight.w500),),
], ],

View File

@ -13,7 +13,7 @@ const kWhite = Color(0xFFFFFFFF);
const kBlack = Color(0xFF000000); const kBlack = Color(0xFF000000);
const kSuccess = Color(0xFF8bc34a); const kSuccess = Color(0xFF8bc34a);
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu"]; const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu", "Quizz"];
const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"]; const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"];
const List<String> languages = ["FR", "NL", "EN", "DE"]; const List<String> languages = ["FR", "NL", "EN", "DE"];
const List<String> resource_types = ["image", "image url", "video url"]; // "video", const List<String> resource_types = ["image", "image url", "video url"]; // "video",

View File

@ -13,14 +13,18 @@ doc/ExportConfigurationDTOAllOf.md
doc/GeoPointDTO.md doc/GeoPointDTO.md
doc/ImageDTO.md doc/ImageDTO.md
doc/ImageGeoPoint.md doc/ImageGeoPoint.md
doc/LevelDTO.md
doc/LoginDTO.md doc/LoginDTO.md
doc/MapDTO.md doc/MapDTO.md
doc/MapTypeApp.md doc/MapTypeApp.md
doc/MenuDTO.md doc/MenuDTO.md
doc/PlayerMessageDTO.md doc/PlayerMessageDTO.md
doc/QuestionDTO.md
doc/QuizzDTO.md
doc/ResourceApi.md doc/ResourceApi.md
doc/ResourceDTO.md doc/ResourceDTO.md
doc/ResourceType.md doc/ResourceType.md
doc/ResponseDTO.md
doc/SectionApi.md doc/SectionApi.md
doc/SectionDTO.md doc/SectionDTO.md
doc/SectionType.md doc/SectionType.md
@ -57,13 +61,17 @@ lib/model/export_configuration_dto_all_of.dart
lib/model/geo_point_dto.dart lib/model/geo_point_dto.dart
lib/model/image_dto.dart lib/model/image_dto.dart
lib/model/image_geo_point.dart lib/model/image_geo_point.dart
lib/model/level_dto.dart
lib/model/login_dto.dart lib/model/login_dto.dart
lib/model/map_dto.dart lib/model/map_dto.dart
lib/model/map_type_app.dart lib/model/map_type_app.dart
lib/model/menu_dto.dart lib/model/menu_dto.dart
lib/model/player_message_dto.dart lib/model/player_message_dto.dart
lib/model/question_dto.dart
lib/model/quizz_dto.dart
lib/model/resource_dto.dart lib/model/resource_dto.dart
lib/model/resource_type.dart lib/model/resource_type.dart
lib/model/response_dto.dart
lib/model/section_dto.dart lib/model/section_dto.dart
lib/model/section_type.dart lib/model/section_type.dart
lib/model/slider_dto.dart lib/model/slider_dto.dart
@ -74,5 +82,3 @@ lib/model/user_detail_dto.dart
lib/model/video_dto.dart lib/model/video_dto.dart
lib/model/web_dto.dart lib/model/web_dto.dart
pubspec.yaml pubspec.yaml
test/export_configuration_dto_all_of_test.dart
test/export_configuration_dto_test.dart

View File

@ -60,7 +60,7 @@ try {
## Documentation for API Endpoints ## Documentation for API Endpoints
All URIs are relative to *http://192.168.31.96* All URIs are relative to *http://localhost:5000*
Class | Method | HTTP request | Description Class | Method | HTTP request | Description
------------ | ------------- | ------------- | ------------- ------------ | ------------- | ------------- | -------------
@ -95,6 +95,7 @@ Class | Method | HTTP request | Description
*SectionApi* | [**sectionGetFromConfiguration**](doc\/SectionApi.md#sectiongetfromconfiguration) | **GET** /api/Section/configuration/{id} | *SectionApi* | [**sectionGetFromConfiguration**](doc\/SectionApi.md#sectiongetfromconfiguration) | **GET** /api/Section/configuration/{id} |
*SectionApi* | [**sectionGetMapDTO**](doc\/SectionApi.md#sectiongetmapdto) | **GET** /api/Section/MapDTO | *SectionApi* | [**sectionGetMapDTO**](doc\/SectionApi.md#sectiongetmapdto) | **GET** /api/Section/MapDTO |
*SectionApi* | [**sectionGetMenuDTO**](doc\/SectionApi.md#sectiongetmenudto) | **GET** /api/Section/MenuDTO | *SectionApi* | [**sectionGetMenuDTO**](doc\/SectionApi.md#sectiongetmenudto) | **GET** /api/Section/MenuDTO |
*SectionApi* | [**sectionGetQuizzDTO**](doc\/SectionApi.md#sectiongetquizzdto) | **GET** /api/Section/QuizzDTO |
*SectionApi* | [**sectionGetSliderDTO**](doc\/SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | *SectionApi* | [**sectionGetSliderDTO**](doc\/SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO |
*SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | *SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
*SectionApi* | [**sectionGetWebDTO**](doc\/SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | *SectionApi* | [**sectionGetWebDTO**](doc\/SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO |
@ -119,13 +120,17 @@ Class | Method | HTTP request | Description
- [GeoPointDTO](doc\/GeoPointDTO.md) - [GeoPointDTO](doc\/GeoPointDTO.md)
- [ImageDTO](doc\/ImageDTO.md) - [ImageDTO](doc\/ImageDTO.md)
- [ImageGeoPoint](doc\/ImageGeoPoint.md) - [ImageGeoPoint](doc\/ImageGeoPoint.md)
- [LevelDTO](doc\/LevelDTO.md)
- [LoginDTO](doc\/LoginDTO.md) - [LoginDTO](doc\/LoginDTO.md)
- [MapDTO](doc\/MapDTO.md) - [MapDTO](doc\/MapDTO.md)
- [MapTypeApp](doc\/MapTypeApp.md) - [MapTypeApp](doc\/MapTypeApp.md)
- [MenuDTO](doc\/MenuDTO.md) - [MenuDTO](doc\/MenuDTO.md)
- [PlayerMessageDTO](doc\/PlayerMessageDTO.md) - [PlayerMessageDTO](doc\/PlayerMessageDTO.md)
- [QuestionDTO](doc\/QuestionDTO.md)
- [QuizzDTO](doc\/QuizzDTO.md)
- [ResourceDTO](doc\/ResourceDTO.md) - [ResourceDTO](doc\/ResourceDTO.md)
- [ResourceType](doc\/ResourceType.md) - [ResourceType](doc\/ResourceType.md)
- [ResponseDTO](doc\/ResponseDTO.md)
- [SectionDTO](doc\/SectionDTO.md) - [SectionDTO](doc\/SectionDTO.md)
- [SectionType](doc\/SectionType.md) - [SectionType](doc\/SectionType.md)
- [SliderDTO](doc\/SliderDTO.md) - [SliderDTO](doc\/SliderDTO.md)

View File

@ -5,7 +5,7 @@
import 'package:managerapi/api.dart'; import 'package:managerapi/api.dart';
``` ```
All URIs are relative to *http://192.168.31.96* All URIs are relative to *http://localhost:5000*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:managerapi/api.dart'; import 'package:managerapi/api.dart';
``` ```
All URIs are relative to *http://192.168.31.96* All URIs are relative to *http://localhost:5000*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------

View File

@ -5,7 +5,7 @@
import 'package:managerapi/api.dart'; import 'package:managerapi/api.dart';
``` ```
All URIs are relative to *http://192.168.31.96* All URIs are relative to *http://localhost:5000*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------

View File

@ -0,0 +1,17 @@
# managerapi.model.LevelDTO
## Load the model package
```dart
import 'package:managerapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**resourceId** | **String** | | [optional]
**source_** | **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)

View File

@ -0,0 +1,19 @@
# managerapi.model.QuestionDTO
## Load the model package
```dart
import 'package:managerapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**responses** | [**List<ResponseDTO>**](ResponseDTO.md) | | [optional] [default to const []]
**resourceId** | **String** | | [optional]
**source_** | **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)

View File

@ -0,0 +1,19 @@
# managerapi.model.QuizzDTO
## Load the model package
```dart
import 'package:managerapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**questions** | [**List<QuestionDTO>**](QuestionDTO.md) | | [optional] [default to const []]
**badLevel** | [**OneOfLevelDTO**](OneOfLevelDTO.md) | | [optional]
**mediumLevel** | [**OneOfLevelDTO**](OneOfLevelDTO.md) | | [optional]
**goodLevel** | [**OneOfLevelDTO**](OneOfLevelDTO.md) | | [optional]
**greatLevel** | [**OneOfLevelDTO**](OneOfLevelDTO.md) | | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -5,7 +5,7 @@
import 'package:managerapi/api.dart'; import 'package:managerapi/api.dart';
``` ```
All URIs are relative to *http://192.168.31.96* All URIs are relative to *http://localhost:5000*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------

View File

@ -0,0 +1,17 @@
# managerapi.model.ResponseDTO
## Load the model package
```dart
import 'package:managerapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**isGood** | **bool** | | [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)

View File

@ -5,7 +5,7 @@
import 'package:managerapi/api.dart'; import 'package:managerapi/api.dart';
``` ```
All URIs are relative to *http://192.168.31.96* All URIs are relative to *http://localhost:5000*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------
@ -18,6 +18,7 @@ Method | HTTP request | Description
[**sectionGetFromConfiguration**](SectionApi.md#sectiongetfromconfiguration) | **GET** /api/Section/configuration/{id} | [**sectionGetFromConfiguration**](SectionApi.md#sectiongetfromconfiguration) | **GET** /api/Section/configuration/{id} |
[**sectionGetMapDTO**](SectionApi.md#sectiongetmapdto) | **GET** /api/Section/MapDTO | [**sectionGetMapDTO**](SectionApi.md#sectiongetmapdto) | **GET** /api/Section/MapDTO |
[**sectionGetMenuDTO**](SectionApi.md#sectiongetmenudto) | **GET** /api/Section/MenuDTO | [**sectionGetMenuDTO**](SectionApi.md#sectiongetmenudto) | **GET** /api/Section/MenuDTO |
[**sectionGetQuizzDTO**](SectionApi.md#sectiongetquizzdto) | **GET** /api/Section/QuizzDTO |
[**sectionGetSliderDTO**](SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO | [**sectionGetSliderDTO**](SectionApi.md#sectiongetsliderdto) | **GET** /api/Section/SliderDTO |
[**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO | [**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
[**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO | [**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO |
@ -401,6 +402,45 @@ This endpoint does not need any parameter.
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **sectionGetQuizzDTO**
> QuizzDTO sectionGetQuizzDTO()
### Example
```dart
import 'package:managerapi/api.dart';
// TODO Configure OAuth2 access token for authorization: bearer
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
final api_instance = SectionApi();
try {
final result = api_instance.sectionGetQuizzDTO();
print(result);
} catch (e) {
print('Exception when calling SectionApi->sectionGetQuizzDTO: $e\n');
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
[**QuizzDTO**](QuizzDTO.md)
### Authorization
[bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **sectionGetSliderDTO** # **sectionGetSliderDTO**
> SliderDTO sectionGetSliderDTO() > SliderDTO sectionGetSliderDTO()

View File

@ -5,7 +5,7 @@
import 'package:managerapi/api.dart'; import 'package:managerapi/api.dart';
``` ```
All URIs are relative to *http://192.168.31.96* All URIs are relative to *http://localhost:5000*
Method | HTTP request | Description Method | HTTP request | Description
------------- | ------------- | ------------- ------------- | ------------- | -------------

View File

@ -43,13 +43,17 @@ part 'model/export_configuration_dto_all_of.dart';
part 'model/geo_point_dto.dart'; part 'model/geo_point_dto.dart';
part 'model/image_dto.dart'; part 'model/image_dto.dart';
part 'model/image_geo_point.dart'; part 'model/image_geo_point.dart';
part 'model/level_dto.dart';
part 'model/login_dto.dart'; part 'model/login_dto.dart';
part 'model/map_dto.dart'; part 'model/map_dto.dart';
part 'model/map_type_app.dart'; part 'model/map_type_app.dart';
part 'model/menu_dto.dart'; part 'model/menu_dto.dart';
part 'model/player_message_dto.dart'; part 'model/player_message_dto.dart';
part 'model/question_dto.dart';
part 'model/quizz_dto.dart';
part 'model/resource_dto.dart'; part 'model/resource_dto.dart';
part 'model/resource_type.dart'; part 'model/resource_type.dart';
part 'model/response_dto.dart';
part 'model/section_dto.dart'; part 'model/section_dto.dart';
part 'model/section_type.dart'; part 'model/section_type.dart';
part 'model/slider_dto.dart'; part 'model/slider_dto.dart';

View File

@ -560,6 +560,58 @@ class SectionApi {
return Future<MenuDTO>.value(null); return Future<MenuDTO>.value(null);
} }
/// Performs an HTTP 'GET /api/Section/QuizzDTO' operation and returns the [Response].
Future<Response> sectionGetQuizzDTOWithHttpInfo() async {
final path = r'/api/Section/QuizzDTO';
Object postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
final contentTypes = <String>[];
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
final authNames = <String>['bearer'];
if (
nullableContentType != null &&
nullableContentType.toLowerCase().startsWith('multipart/form-data')
) {
bool hasFields = false;
final mp = MultipartRequest(null, null);
if (hasFields) {
postBody = mp;
}
} else {
}
return await apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
nullableContentType,
authNames,
);
}
Future<QuizzDTO> sectionGetQuizzDTO() async {
final response = await sectionGetQuizzDTOWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body != null && response.statusCode != HttpStatus.noContent) {
return apiClient.deserialize(_decodeBodyBytes(response), 'QuizzDTO') as QuizzDTO;
}
return Future<QuizzDTO>.value(null);
}
/// Performs an HTTP 'GET /api/Section/SliderDTO' operation and returns the [Response]. /// Performs an HTTP 'GET /api/Section/SliderDTO' operation and returns the [Response].
Future<Response> sectionGetSliderDTOWithHttpInfo() async { Future<Response> sectionGetSliderDTOWithHttpInfo() async {
final path = r'/api/Section/SliderDTO'; final path = r'/api/Section/SliderDTO';

View File

@ -10,7 +10,7 @@
part of openapi.api; part of openapi.api;
class ApiClient { class ApiClient {
ApiClient({this.basePath = 'http://192.168.31.96'}) { ApiClient({this.basePath = 'http://localhost:5000'}) {
// Setup authentications (key: authentication name, value: authentication). // Setup authentications (key: authentication name, value: authentication).
_authentications[r'bearer'] = OAuth(); _authentications[r'bearer'] = OAuth();
} }
@ -174,6 +174,8 @@ class ApiClient {
return ImageDTO.fromJson(value); return ImageDTO.fromJson(value);
case 'ImageGeoPoint': case 'ImageGeoPoint':
return ImageGeoPoint.fromJson(value); return ImageGeoPoint.fromJson(value);
case 'LevelDTO':
return LevelDTO.fromJson(value);
case 'LoginDTO': case 'LoginDTO':
return LoginDTO.fromJson(value); return LoginDTO.fromJson(value);
case 'MapDTO': case 'MapDTO':
@ -185,11 +187,17 @@ class ApiClient {
return MenuDTO.fromJson(value); return MenuDTO.fromJson(value);
case 'PlayerMessageDTO': case 'PlayerMessageDTO':
return PlayerMessageDTO.fromJson(value); return PlayerMessageDTO.fromJson(value);
case 'QuestionDTO':
return QuestionDTO.fromJson(value);
case 'QuizzDTO':
return QuizzDTO.fromJson(value);
case 'ResourceDTO': case 'ResourceDTO':
return ResourceDTO.fromJson(value); return ResourceDTO.fromJson(value);
case 'ResourceType': case 'ResourceType':
return ResourceTypeTypeTransformer().decode(value); return ResourceTypeTypeTransformer().decode(value);
case 'ResponseDTO':
return ResponseDTO.fromJson(value);
case 'SectionDTO': case 'SectionDTO':
return SectionDTO.fromJson(value); return SectionDTO.fromJson(value);
case 'SectionType': case 'SectionType':

View File

@ -0,0 +1,89 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class LevelDTO {
/// Returns a new [LevelDTO] instance.
LevelDTO({
this.label,
this.resourceId,
this.source_,
});
List<TranslationDTO> label;
String resourceId;
String source_;
@override
bool operator ==(Object other) => identical(this, other) || other is LevelDTO &&
other.label == label &&
other.resourceId == resourceId &&
other.source_ == source_;
@override
int get hashCode =>
(label == null ? 0 : label.hashCode) +
(resourceId == null ? 0 : resourceId.hashCode) +
(source_ == null ? 0 : source_.hashCode);
@override
String toString() => 'LevelDTO[label=$label, resourceId=$resourceId, source_=$source_]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (label != null) {
json[r'label'] = label;
}
if (resourceId != null) {
json[r'resourceId'] = resourceId;
}
if (source_ != null) {
json[r'source'] = source_;
}
return json;
}
/// Returns a new [LevelDTO] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static LevelDTO fromJson(Map<String, dynamic> json) => json == null
? null
: LevelDTO(
label: TranslationDTO.listFromJson(json[r'label']),
resourceId: json[r'resourceId'],
source_: json[r'source'],
);
static List<LevelDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <LevelDTO>[]
: json.map((v) => LevelDTO.fromJson(v)).toList(growable: true == growable);
static Map<String, LevelDTO> mapFromJson(Map<String, dynamic> json) {
final map = <String, LevelDTO>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = LevelDTO.fromJson(v));
}
return map;
}
// maps a json object with a list of LevelDTO-objects as value to a dart map
static Map<String, List<LevelDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<LevelDTO>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = LevelDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}

View File

@ -0,0 +1,107 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class QuestionDTO {
/// Returns a new [QuestionDTO] instance.
QuestionDTO({
this.label,
this.responses,
this.resourceId,
this.source_,
this.order,
});
List<TranslationDTO> label;
List<ResponseDTO> responses;
String resourceId;
String source_;
int order;
@override
bool operator ==(Object other) => identical(this, other) || other is QuestionDTO &&
other.label == label &&
other.responses == responses &&
other.resourceId == resourceId &&
other.source_ == source_ &&
other.order == order;
@override
int get hashCode =>
(label == null ? 0 : label.hashCode) +
(responses == null ? 0 : responses.hashCode) +
(resourceId == null ? 0 : resourceId.hashCode) +
(source_ == null ? 0 : source_.hashCode) +
(order == null ? 0 : order.hashCode);
@override
String toString() => 'QuestionDTO[label=$label, responses=$responses, resourceId=$resourceId, source_=$source_, order=$order]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (label != null) {
json[r'label'] = label;
}
if (responses != null) {
json[r'responses'] = responses;
}
if (resourceId != null) {
json[r'resourceId'] = resourceId;
}
if (source_ != null) {
json[r'source'] = source_;
}
if (order != null) {
json[r'order'] = order;
}
return json;
}
/// Returns a new [QuestionDTO] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static QuestionDTO fromJson(Map<String, dynamic> json) => json == null
? null
: QuestionDTO(
label: TranslationDTO.listFromJson(json[r'label']),
responses: ResponseDTO.listFromJson(json[r'responses']),
resourceId: json[r'resourceId'],
source_: json[r'source'],
order: json[r'order'],
);
static List<QuestionDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <QuestionDTO>[]
: json.map((v) => QuestionDTO.fromJson(v)).toList(growable: true == growable);
static Map<String, QuestionDTO> mapFromJson(Map<String, dynamic> json) {
final map = <String, QuestionDTO>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = QuestionDTO.fromJson(v));
}
return map;
}
// maps a json object with a list of QuestionDTO-objects as value to a dart map
static Map<String, List<QuestionDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<QuestionDTO>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = QuestionDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}

View File

@ -0,0 +1,107 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class QuizzDTO {
/// Returns a new [QuizzDTO] instance.
QuizzDTO({
this.questions,
this.badLevel,
this.mediumLevel,
this.goodLevel,
this.greatLevel,
});
List<QuestionDTO> questions;
LevelDTO badLevel;
LevelDTO mediumLevel;
LevelDTO goodLevel;
LevelDTO greatLevel;
@override
bool operator ==(Object other) => identical(this, other) || other is QuizzDTO &&
other.questions == questions &&
other.badLevel == badLevel &&
other.mediumLevel == mediumLevel &&
other.goodLevel == goodLevel &&
other.greatLevel == greatLevel;
@override
int get hashCode =>
(questions == null ? 0 : questions.hashCode) +
(badLevel == null ? 0 : badLevel.hashCode) +
(mediumLevel == null ? 0 : mediumLevel.hashCode) +
(goodLevel == null ? 0 : goodLevel.hashCode) +
(greatLevel == null ? 0 : greatLevel.hashCode);
@override
String toString() => 'QuizzDTO[questions=$questions, badLevel=$badLevel, mediumLevel=$mediumLevel, goodLevel=$goodLevel, greatLevel=$greatLevel]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (questions != null) {
json[r'questions'] = questions;
}
if (badLevel != null) {
json[r'bad_level'] = badLevel;
}
if (mediumLevel != null) {
json[r'medium_level'] = mediumLevel;
}
if (goodLevel != null) {
json[r'good_level'] = goodLevel;
}
if (greatLevel != null) {
json[r'great_level'] = greatLevel;
}
return json;
}
/// Returns a new [QuizzDTO] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static QuizzDTO fromJson(Map<String, dynamic> json) => json == null
? null
: QuizzDTO(
questions: QuestionDTO.listFromJson(json[r'questions']),
badLevel: LevelDTO.fromJson(json[r'bad_level']),
mediumLevel: LevelDTO.fromJson(json[r'medium_level']),
goodLevel: LevelDTO.fromJson(json[r'good_level']),
greatLevel: LevelDTO.fromJson(json[r'great_level']),
);
static List<QuizzDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <QuizzDTO>[]
: json.map((v) => QuizzDTO.fromJson(v)).toList(growable: true == growable);
static Map<String, QuizzDTO> mapFromJson(Map<String, dynamic> json) {
final map = <String, QuizzDTO>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = QuizzDTO.fromJson(v));
}
return map;
}
// maps a json object with a list of QuizzDTO-objects as value to a dart map
static Map<String, List<QuizzDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<QuizzDTO>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = QuizzDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}

View File

@ -0,0 +1,89 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class ResponseDTO {
/// Returns a new [ResponseDTO] instance.
ResponseDTO({
this.label,
this.isGood,
this.order,
});
List<TranslationDTO> label;
bool isGood;
int order;
@override
bool operator ==(Object other) => identical(this, other) || other is ResponseDTO &&
other.label == label &&
other.isGood == isGood &&
other.order == order;
@override
int get hashCode =>
(label == null ? 0 : label.hashCode) +
(isGood == null ? 0 : isGood.hashCode) +
(order == null ? 0 : order.hashCode);
@override
String toString() => 'ResponseDTO[label=$label, isGood=$isGood, order=$order]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (label != null) {
json[r'label'] = label;
}
if (isGood != null) {
json[r'isGood'] = isGood;
}
if (order != null) {
json[r'order'] = order;
}
return json;
}
/// Returns a new [ResponseDTO] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static ResponseDTO fromJson(Map<String, dynamic> json) => json == null
? null
: ResponseDTO(
label: TranslationDTO.listFromJson(json[r'label']),
isGood: json[r'isGood'],
order: json[r'order'],
);
static List<ResponseDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <ResponseDTO>[]
: json.map((v) => ResponseDTO.fromJson(v)).toList(growable: true == growable);
static Map<String, ResponseDTO> mapFromJson(Map<String, dynamic> json) {
final map = <String, ResponseDTO>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = ResponseDTO.fromJson(v));
}
return map;
}
// maps a json object with a list of ResponseDTO-objects as value to a dart map
static Map<String, List<ResponseDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<ResponseDTO>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = ResponseDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}

View File

@ -27,6 +27,7 @@ class SectionType {
static const video = SectionType._(r'Video'); static const video = SectionType._(r'Video');
static const web = SectionType._(r'Web'); static const web = SectionType._(r'Web');
static const menu = SectionType._(r'Menu'); static const menu = SectionType._(r'Menu');
static const quizz = SectionType._(r'Quizz');
/// List of all possible values in this [enum][SectionType]. /// List of all possible values in this [enum][SectionType].
static const values = <SectionType>[ static const values = <SectionType>[
@ -35,6 +36,7 @@ class SectionType {
video, video,
web, web,
menu, menu,
quizz,
]; ];
static SectionType fromJson(dynamic value) => static SectionType fromJson(dynamic value) =>
@ -72,6 +74,7 @@ class SectionTypeTypeTransformer {
case r'Video': return SectionType.video; case r'Video': return SectionType.video;
case r'Web': return SectionType.web; case r'Web': return SectionType.web;
case r'Menu': return SectionType.menu; case r'Menu': return SectionType.menu;
case r'Quizz': return SectionType.quizz;
default: default:
if (allowNull == false) { if (allowNull == false) {
throw ArgumentError('Unknown enum value to decode: $data'); throw ArgumentError('Unknown enum value to decode: $data');

File diff suppressed because it is too large Load Diff

1885
manager_api/swagger.yaml.bak Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,36 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
import 'package:managerapi/api.dart';
import 'package:test/test.dart';
// tests for LevelDTO
void main() {
final instance = LevelDTO();
group('test LevelDTO', () {
// List<TranslationDTO> label (default value: const [])
test('to test the property `label`', () async {
// TODO
});
// String resourceId
test('to test the property `resourceId`', () async {
// TODO
});
// String source_
test('to test the property `source_`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,41 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
import 'package:managerapi/api.dart';
import 'package:test/test.dart';
// tests for QuestionDTO
void main() {
final instance = QuestionDTO();
group('test QuestionDTO', () {
// List<TranslationDTO> label (default value: const [])
test('to test the property `label`', () async {
// TODO
});
// List<ResponseDTO> responses (default value: const [])
test('to test the property `responses`', () async {
// TODO
});
// String resourceId
test('to test the property `resourceId`', () async {
// TODO
});
// String source_
test('to test the property `source_`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,46 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
import 'package:managerapi/api.dart';
import 'package:test/test.dart';
// tests for QuizzDTO
void main() {
final instance = QuizzDTO();
group('test QuizzDTO', () {
// List<QuestionDTO> questions (default value: const [])
test('to test the property `questions`', () async {
// TODO
});
// OneOfLevelDTO badLevel
test('to test the property `badLevel`', () async {
// TODO
});
// OneOfLevelDTO mediumLevel
test('to test the property `mediumLevel`', () async {
// TODO
});
// OneOfLevelDTO goodLevel
test('to test the property `goodLevel`', () async {
// TODO
});
// OneOfLevelDTO greatLevel
test('to test the property `greatLevel`', () async {
// TODO
});
});
}

View File

@ -0,0 +1,31 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
import 'package:managerapi/api.dart';
import 'package:test/test.dart';
// tests for ResponseDTO
void main() {
final instance = ResponseDTO();
group('test ResponseDTO', () {
// List<TranslationDTO> label (default value: const [])
test('to test the property `label`', () async {
// TODO
});
// bool isGood
test('to test the property `isGood`', () async {
// TODO
});
});
}

View File

@ -198,6 +198,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.11" version: "0.12.11"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
material_segmented_control: material_segmented_control:
dependency: "direct main" dependency: "direct main"
description: description:
@ -314,7 +321,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.3" version: "0.4.8"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -328,7 +335,7 @@ packages:
name: vector_math name: vector_math
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0" version: "2.1.1"
video_player: video_player:
dependency: "direct main" dependency: "direct main"
description: description:
@ -351,5 +358,5 @@ packages:
source: hosted source: hosted
version: "2.0.3" version: "2.0.3"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" dart: ">=2.14.0 <3.0.0"
flutter: ">=2.0.0" flutter: ">=2.0.0"