misc !
This commit is contained in:
parent
4818a1af52
commit
e644cd487f
@ -25,7 +25,11 @@ class _ColorPickerInputContainerState extends State<ColorPickerInputContainer> {
|
||||
@override
|
||||
void initState() {
|
||||
setState(() {
|
||||
colorVar = widget.color == null ? new Color(0x12345678) : new Color(int.parse(widget.color!.split('(0x')[1].split(')')[0], radix: 16));
|
||||
try {
|
||||
colorVar = widget.color == null || widget.color!.isEmpty ? new Color(0x12345678) : new Color(int.parse(widget.color!.split('(0x')[1].split(')')[0], radix: 16));
|
||||
} catch(e) {
|
||||
colorVar = new Color(0x12345678);
|
||||
}
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
@ -55,7 +59,7 @@ class _ColorPickerInputContainerState extends State<ColorPickerInputContainer> {
|
||||
setState(() {
|
||||
colorVar = color;
|
||||
});
|
||||
widget.onChanged(color.toString());
|
||||
widget.onChanged(colorToString(color));
|
||||
},
|
||||
context
|
||||
);
|
||||
@ -74,4 +78,20 @@ class _ColorPickerInputContainerState extends State<ColorPickerInputContainer> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String colorToString(Color color) {
|
||||
int a = (color.a * 255).round();
|
||||
int r = (color.r * 255).round();
|
||||
int g = (color.g * 255).round();
|
||||
int b = (color.b * 255).round();
|
||||
|
||||
final aHex = a.toRadixString(16).padLeft(2, '0');
|
||||
final rHex = r.toRadixString(16).padLeft(2, '0');
|
||||
final gHex = g.toRadixString(16).padLeft(2, '0');
|
||||
final bHex = b.toRadixString(16).padLeft(2, '0');
|
||||
|
||||
return 'Color(0x$aHex$rHex$gHex$bHex)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -13,7 +13,7 @@ IconData getSectionIcon(elementType) {
|
||||
return Icons.web;
|
||||
case SectionType.Menu:
|
||||
return Icons.apps_sharp;
|
||||
case SectionType.Quizz:
|
||||
case SectionType.Quiz:
|
||||
return Icons.question_answer;
|
||||
case SectionType.Article:
|
||||
return Icons.article_outlined;
|
||||
|
||||
@ -7,7 +7,7 @@ import 'dart:html' as html;
|
||||
|
||||
class PDFHelper {
|
||||
static downloadPDF(ManagerAppContext managerAppContext, List<SectionDTO> sections) async {
|
||||
var sectionsArticle = sections.where((section) => section.type == SectionType.Article || section.type == SectionType.Quizz); // TODO HERE Support more section types
|
||||
var sectionsArticle = sections.where((section) => section.type == SectionType.Article || section.type == SectionType.Quiz); // TODO HERE Support more section types
|
||||
if(sectionsArticle.length > 0) {
|
||||
//final font = await rootBundle.load("fonts/OpenSans-Medium.ttf");
|
||||
//Uint8List byteData = new File("fonts/OpenSans-Medium.ttf").readAsBytesSync();
|
||||
|
||||
@ -15,7 +15,7 @@ class ArticleConfig extends StatefulWidget {
|
||||
final String? color;
|
||||
final String? label;
|
||||
final ArticleDTO initialValue;
|
||||
final ValueChanged<String> onChanged;
|
||||
final ValueChanged<ArticleDTO> onChanged;
|
||||
const ArticleConfig({
|
||||
Key? key,
|
||||
this.color,
|
||||
@ -61,7 +61,7 @@ class _ArticleConfigState extends State<ArticleConfig> {
|
||||
i++;
|
||||
});
|
||||
|
||||
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||
widget.onChanged(articleDTO);
|
||||
},
|
||||
);
|
||||
}
|
||||
@ -83,14 +83,14 @@ class _ArticleConfigState extends State<ArticleConfig> {
|
||||
modalLabel: "Contenu",
|
||||
color: kPrimaryColor,
|
||||
isHTML: true,
|
||||
initialValue: articleDTO != null ? articleDTO.content! : [],
|
||||
initialValue: articleDTO.content!,
|
||||
isTitle: false,
|
||||
onGetResult: (value) {
|
||||
setState(() {
|
||||
if (articleDTO.content! != value) {
|
||||
articleDTO.content = value;
|
||||
//save(true, articleDTO, appContext);
|
||||
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||
widget.onChanged(articleDTO);
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -103,7 +103,7 @@ class _ArticleConfigState extends State<ArticleConfig> {
|
||||
setState(() {
|
||||
//print(value);
|
||||
articleDTO.isContentTop = value;
|
||||
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||
widget.onChanged(articleDTO);
|
||||
});
|
||||
},
|
||||
),
|
||||
@ -117,14 +117,14 @@ class _ArticleConfigState extends State<ArticleConfig> {
|
||||
resourceTypes: [ResourceType.Audio],
|
||||
modalLabel: "Audio",
|
||||
color: kPrimaryColor,
|
||||
initialValue: articleDTO != null ? articleDTO.audioIds! : [],
|
||||
initialValue: articleDTO.audioIds!,
|
||||
isTitle: false,
|
||||
onGetResult: (value) {
|
||||
setState(() {
|
||||
if (articleDTO.audioIds != value) {
|
||||
articleDTO.audioIds = value;
|
||||
//save(true, articleDTO, appContext);
|
||||
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||
widget.onChanged(articleDTO);
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -137,7 +137,7 @@ class _ArticleConfigState extends State<ArticleConfig> {
|
||||
setState(() {
|
||||
//print(value);
|
||||
articleDTO.isReadAudioAuto = value;
|
||||
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||
widget.onChanged(articleDTO);
|
||||
});
|
||||
},
|
||||
),
|
||||
@ -184,7 +184,7 @@ class _ArticleConfigState extends State<ArticleConfig> {
|
||||
articleToSend.isContentTop = articleDTO.isContentTop;
|
||||
articleToSend.content = articleDTO.content;
|
||||
articleToSend.isReadAudioAuto = articleDTO.isReadAudioAuto;
|
||||
widget.onChanged(jsonEncode(articleToSend).toString());
|
||||
widget.onChanged(articleToSend);
|
||||
});
|
||||
},
|
||||
true, // don't show titles
|
||||
@ -213,7 +213,7 @@ class _ArticleConfigState extends State<ArticleConfig> {
|
||||
setState(() {
|
||||
result.order = articleDTO.contents!.length;
|
||||
articleDTO.contents!.add(result);
|
||||
widget.onChanged(jsonEncode(articleDTO).toString());
|
||||
widget.onChanged(articleDTO);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@ -133,6 +133,9 @@ class _CategoryListState extends State<CategoryList> {
|
||||
if (result != null)
|
||||
{
|
||||
setState(() {
|
||||
if(result.id == null) {
|
||||
result.id = categoriesMiddle.isEmpty ? 1 : categoriesMiddle.map((c) => c.id!).reduce((a, b) => a > b ? a : b) + 1;
|
||||
}
|
||||
result.order = categoriesMiddle.length;
|
||||
categoriesMiddle.add(result);
|
||||
widget.onChanged(categoriesMiddle);
|
||||
|
||||
@ -99,12 +99,11 @@ class _GeoPointContentListState extends State<GeoPointContentList> {
|
||||
);
|
||||
if (result != null) {
|
||||
setState(() {
|
||||
print("TODO CHECK !!");
|
||||
ContentDTO newImage = new ContentDTO(resourceId: result.id, resource: ResourceDTO(url: result.url, label: result.label, type: result.type));
|
||||
//print("RESULT IMAGES = ");
|
||||
//print(newImage);
|
||||
ContentDTO newImage = new ContentDTO(resourceId: result.id, resource: result);
|
||||
if(newImage.order == null) {
|
||||
newImage.order = contentsGeo.isEmpty ? 1 : contentsGeo.map((cg) => cg.order!).reduce((a, b) => a > b ? a : b) + 1;
|
||||
}
|
||||
contentsGeo.add(newImage);
|
||||
//print(imagesGeo);
|
||||
widget.onChanged(contentsGeo);
|
||||
});
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
import 'package:location_picker_flutter_map/location_picker_flutter_map.dart';
|
||||
import 'package:manager_app/Components/geoloc_input_container.dart';
|
||||
import 'package:manager_app/Components/multi_select_dropdown_language_container.dart';
|
||||
import 'package:manager_app/Models/managerContext.dart';
|
||||
import 'package:manager_app/Screens/Configurations/Section/SubSection/Map/category_input_container.dart';
|
||||
import 'package:manager_app/Components/dropDown_input_container.dart';
|
||||
import 'package:manager_app/Components/fetch_section_icon.dart';
|
||||
@ -400,7 +401,7 @@ class _MapConfigState extends State<MapConfig> {
|
||||
showNewOrUpdateGeoPoint(
|
||||
mapDTO,
|
||||
null,
|
||||
(GeoPointDTO geoPoint) {
|
||||
(GeoPointDTO geoPoint) async {
|
||||
setState(() {
|
||||
mapDTO.points!.add(geoPoint);
|
||||
mapDTO.points!.sort((a, b) => a.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase().compareTo(b.title!.firstWhere((t) => t.language == 'FR').value!.toLowerCase()));
|
||||
@ -416,6 +417,9 @@ class _MapConfigState extends State<MapConfig> {
|
||||
//widget.onChanged(jsonEncode(mapDTO).toString());
|
||||
widget.onChanged(mapDTO);
|
||||
});
|
||||
|
||||
await (appContext.getContext() as ManagerAppContext).clientAPI!.sectionMapApi!.sectionMapCreate(mapDTO.id!, geoPoint);
|
||||
// TODO refresh points list
|
||||
},
|
||||
appContext,
|
||||
context);
|
||||
|
||||
@ -84,13 +84,15 @@ Future<CategorieDTO?> showNewOrUpdateCategory(CategorieDTO? inputCategorieDTO, A
|
||||
color: kPrimaryColor,
|
||||
onChanged: (ResourceDTO resource) {
|
||||
if(resource.id == null) {
|
||||
categorieDTO.resourceDTO?.id = null;
|
||||
categorieDTO.resourceDTO = null;
|
||||
/*categorieDTO.resourceDTO?.id = null;
|
||||
categorieDTO.resourceDTO?.url = null;
|
||||
categorieDTO.resourceDTO?.label = null;
|
||||
categorieDTO.resourceDTO?.label = null;*/
|
||||
} else {
|
||||
categorieDTO.resourceDTO?.id = resource.id;
|
||||
categorieDTO.resourceDTO = resource;
|
||||
/*categorieDTO.resourceDTO?.id = resource.id;
|
||||
categorieDTO.resourceDTO?.url = resource.url;
|
||||
categorieDTO.resourceDTO?.label = resource.label;
|
||||
categorieDTO.resourceDTO?.label = resource.label;*/
|
||||
print("Icône catégorie Icône catégorie");
|
||||
print(categorieDTO);
|
||||
}
|
||||
|
||||
@ -49,6 +49,7 @@ class SectionDetailScreen extends StatefulWidget {
|
||||
|
||||
class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
late SectionDTO sectionDTO;
|
||||
late Object sectionDetailDTO;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -63,9 +64,11 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
rawSectionData = snapshot.data;
|
||||
sectionDTO = SectionDTO.fromJson(rawSectionData)!; // TODO handle null value !
|
||||
|
||||
if(sectionDTO != null) {
|
||||
var nullableSection = SectionDTO.fromJson(rawSectionData);
|
||||
|
||||
if(nullableSection != null) {
|
||||
sectionDTO = nullableSection;
|
||||
return Stack(
|
||||
children: [
|
||||
bodySection(rawSectionData, size, appContext, context, globalKey),
|
||||
@ -73,7 +76,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
alignment: AlignmentDirectional.bottomCenter,
|
||||
child: Container(
|
||||
height: 80,
|
||||
child: getButtons(sectionDTO!, appContext),
|
||||
child: getButtons(sectionDTO, appContext),
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -122,19 +125,19 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Icon(
|
||||
sectionDTO != null ? getSectionIcon(sectionDTO.type) : Icons.add,
|
||||
getSectionIcon(sectionDTO.type),
|
||||
color: kPrimaryColor,
|
||||
size: 25,
|
||||
),
|
||||
),
|
||||
Text(sectionDTO != null ? sectionDTO.label! : "", style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)),
|
||||
Text(sectionDTO.label!, style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)),
|
||||
if((appContext.getContext() as ManagerAppContext).selectedConfiguration!.isMobile!)
|
||||
DownloadPDF(sections: [sectionDTO!]),
|
||||
DownloadPDF(sections: [sectionDTO]),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: Text(sectionDTO != null ? DateFormat('dd/MM/yyyy').format(sectionDTO.dateCreation!) : "", style: TextStyle(fontSize: 15, fontWeight: FontWeight.w200)),
|
||||
child: Text(DateFormat('dd/MM/yyyy').format(sectionDTO.dateCreation!), style: TextStyle(fontSize: 15, fontWeight: FontWeight.w200)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -197,7 +200,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
key: globalKey,
|
||||
child: QrImageView(
|
||||
padding: EdgeInsets.only(left: 5.0, top: 5.0, bottom: 5.0, right: 5.0),
|
||||
data: "${managerAppContext.host!.replaceFirst("api", "web")}/${managerAppContext.instanceId}/${managerAppContext.selectedConfiguration!.id}/${sectionDTO!.id!}",
|
||||
data: "${managerAppContext.host!.replaceFirst("api", "web")}/${managerAppContext.instanceId}/${managerAppContext.selectedConfiguration!.id}/${sectionDTO.id!}",
|
||||
version: QrVersions.auto,
|
||||
size: 50.0,
|
||||
),
|
||||
@ -214,7 +217,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
sectionDTO.isBeacon = value;
|
||||
save(false, sectionDTO, appContext);
|
||||
save(false, appContext);
|
||||
});
|
||||
},
|
||||
),
|
||||
@ -242,9 +245,9 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
height: 100,
|
||||
child: StringInputContainer(
|
||||
label: "Identifiant :",
|
||||
initialValue: sectionDTO != null ? sectionDTO.label : "",
|
||||
initialValue: sectionDTO.label,
|
||||
onChanged: (String value) {
|
||||
sectionDTO!.label = value;
|
||||
sectionDTO.label = value;
|
||||
},
|
||||
),
|
||||
),
|
||||
@ -252,11 +255,11 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
label: "Titre affiché:",
|
||||
modalLabel: "Titre",
|
||||
color: kPrimaryColor,
|
||||
initialValue: sectionDTO != null ? sectionDTO.title! : [],
|
||||
initialValue: sectionDTO.title!,
|
||||
onGetResult: (value) {
|
||||
if (sectionDTO!.title! != value) {
|
||||
if (sectionDTO.title! != value) {
|
||||
sectionDTO.title = value;
|
||||
save(true, sectionDTO, appContext);
|
||||
save(true, appContext);
|
||||
}
|
||||
},
|
||||
maxLines: 1,
|
||||
@ -269,12 +272,12 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
modalLabel: "Description",
|
||||
color: kPrimaryColor,
|
||||
isHTML: true,
|
||||
initialValue: sectionDTO != null ? sectionDTO.description! : [],
|
||||
initialValue: sectionDTO.description!,
|
||||
isMandatory: false,
|
||||
onGetResult: (value) {
|
||||
if (sectionDTO!.description != value) {
|
||||
if (sectionDTO.description != value) {
|
||||
sectionDTO.description = value!;
|
||||
save(true, sectionDTO, appContext);
|
||||
save(true, appContext);
|
||||
}
|
||||
},
|
||||
maxLines: 2,
|
||||
@ -288,14 +291,14 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
children: [
|
||||
ResourceInputContainer(
|
||||
label: "Image :",
|
||||
initialValue: sectionDTO != null ? sectionDTO.imageId : null,
|
||||
initialValue: sectionDTO.imageId,
|
||||
color: kPrimaryColor,
|
||||
onChanged: (ResourceDTO resource) {
|
||||
if(resource.id == null) {
|
||||
sectionDTO!.imageId = null;
|
||||
sectionDTO.imageId = null;
|
||||
sectionDTO.imageSource = null;
|
||||
} else {
|
||||
sectionDTO!.imageId = resource.id;
|
||||
sectionDTO.imageId = resource.id;
|
||||
sectionDTO.imageSource = resource.url;
|
||||
}
|
||||
},
|
||||
@ -315,7 +318,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
height: size.height * 0.5,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: sectionDTO != null ? getSpecificData(sectionDTO, rawSectionDTO, appContext) : null,
|
||||
child: getSpecificData(rawSectionDTO, appContext),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
//color: Colors.lightGreen,
|
||||
@ -343,7 +346,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
textColor: Colors.white,
|
||||
fontSize: 15,
|
||||
press: () {
|
||||
cancel(sectionDTO, appContext);
|
||||
cancel(appContext);
|
||||
},
|
||||
),
|
||||
),
|
||||
@ -356,7 +359,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
textColor: Colors.white,
|
||||
fontSize: 15,
|
||||
press: () {
|
||||
delete(sectionDTO, appContext);
|
||||
delete(appContext);
|
||||
},
|
||||
),
|
||||
),
|
||||
@ -369,7 +372,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
textColor: Colors.white,
|
||||
fontSize: 15,
|
||||
press: () {
|
||||
save(false, sectionDTO, appContext);
|
||||
save(false, appContext);
|
||||
},
|
||||
),
|
||||
),
|
||||
@ -378,15 +381,18 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> cancel(SectionDTO sectionDTO, AppContext appContext) async {
|
||||
Future<void> cancel(AppContext appContext) async {
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
Object? section = await (appContext.getContext() as ManagerAppContext).clientAPI!.sectionApi!.sectionGetDetail(sectionDTO.id!);
|
||||
// TODO parse as SectionDTO
|
||||
managerAppContext.selectedSection = section as SectionDTO;
|
||||
appContext.setContext(managerAppContext);
|
||||
Object? rawData = await (appContext.getContext() as ManagerAppContext).clientAPI!.sectionApi!.sectionGetDetail(sectionDTO.id!);
|
||||
var nullableSection = SectionDTO.fromJson(rawData);
|
||||
if(nullableSection != null)
|
||||
{
|
||||
managerAppContext.selectedSection = nullableSection!;
|
||||
appContext.setContext(managerAppContext);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> delete(SectionDTO sectionDTO, AppContext appContext) async {
|
||||
Future<void> delete(AppContext appContext) async {
|
||||
showConfirmationDialog(
|
||||
"Êtes-vous sûr de vouloir supprimer cette section ?",
|
||||
() {},
|
||||
@ -400,8 +406,8 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> save(bool isTraduction, SectionDTO sectionDTO, AppContext appContext) async {
|
||||
SectionDTO? section = await (appContext.getContext() as ManagerAppContext).clientAPI!.sectionApi!.sectionUpdate(sectionDTO);
|
||||
Future<void> save(bool isTraduction, AppContext appContext) async {
|
||||
SectionDTO? section = await (appContext.getContext() as ManagerAppContext).clientAPI!.sectionApi!.sectionUpdate(sectionDetailDTO);
|
||||
ManagerAppContext managerAppContext = appContext.getContext();
|
||||
managerAppContext.selectedSection = section;
|
||||
appContext.setContext(managerAppContext);
|
||||
@ -413,22 +419,20 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
getSpecificData(SectionDTO sectionDTO, Object? rawSectionData, AppContext appContext) {
|
||||
// TODO handle null value !
|
||||
|
||||
getSpecificData(Object? rawSectionData, AppContext appContext) {
|
||||
switch(sectionDTO.type) {
|
||||
case SectionType.Map:
|
||||
MapDTO mapDTO = MapDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = mapDTO;
|
||||
return MapConfig(
|
||||
initialValue: mapDTO,
|
||||
onChanged: (MapDTO mapDTO) {
|
||||
// TODO DO something
|
||||
//sectionDTO.data = data;
|
||||
//save(false, sectionDTO, appContext);
|
||||
onChanged: (MapDTO changedMap) {
|
||||
sectionDetailDTO = changedMap;
|
||||
},
|
||||
);
|
||||
case SectionType.Slider:
|
||||
SliderDTO sliderDTO = SliderDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = sliderDTO;
|
||||
return SliderConfig(
|
||||
initialValue: sliderDTO,
|
||||
onChanged: (String data) {
|
||||
@ -440,6 +444,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
case SectionType.Video:
|
||||
case SectionType.Web:
|
||||
WebDTO webDTO = WebDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = webDTO;
|
||||
return WebOrVideoConfig(
|
||||
label: sectionDTO.type == SectionType.Video ? "Url de la vidéo:": "Url du site web:",
|
||||
initialValue: webDTO,
|
||||
@ -450,14 +455,16 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
);
|
||||
case SectionType.Menu:
|
||||
MenuDTO menuDTO = MenuDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = menuDTO;
|
||||
return MenuConfig(
|
||||
initialValue: menuDTO,
|
||||
onChanged: (String data) {
|
||||
//sectionDTO.data = data;
|
||||
},
|
||||
);
|
||||
case SectionType.Quizz:
|
||||
case SectionType.Quiz:
|
||||
QuizDTO quizDTO = QuizDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = quizDTO;
|
||||
return QuizzConfig(
|
||||
initialValue: quizDTO,
|
||||
onChanged: (String data) {
|
||||
@ -466,15 +473,17 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
);
|
||||
case SectionType.Article:
|
||||
ArticleDTO articleDTO = ArticleDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = articleDTO;
|
||||
return ArticleConfig(
|
||||
initialValue: articleDTO,
|
||||
onChanged: (String data) {
|
||||
/*sectionDTO.data = data;
|
||||
save(false, sectionDTO, appContext);*/
|
||||
onChanged: (ArticleDTO changedArticle)
|
||||
{
|
||||
sectionDetailDTO = changedArticle;
|
||||
},
|
||||
);
|
||||
case SectionType.Pdf:
|
||||
PdfDTO pdfDTO = PdfDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = pdfDTO;
|
||||
return PDFConfig(
|
||||
initialValue: pdfDTO,
|
||||
onChanged: (String data) {
|
||||
@ -484,6 +493,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
);
|
||||
case SectionType.Puzzle:
|
||||
PuzzleDTO puzzleDTO = PuzzleDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = puzzleDTO;
|
||||
return PuzzleConfig(
|
||||
initialValue: puzzleDTO,
|
||||
onChanged: (String data) {
|
||||
@ -492,6 +502,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
);
|
||||
case SectionType.Agenda:
|
||||
AgendaDTO agendaDTO = AgendaDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = agendaDTO;
|
||||
return AgendaConfig(
|
||||
initialValue: agendaDTO,
|
||||
onChanged: (String data) {
|
||||
@ -501,6 +512,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||
);
|
||||
case SectionType.Weather:
|
||||
WeatherDTO weatherDTO = WeatherDTO.fromJson(rawSectionData)!;
|
||||
sectionDetailDTO = weatherDTO;
|
||||
return WeatherConfig(
|
||||
initialValue: weatherDTO,
|
||||
onChanged: (String data) {
|
||||
|
||||
@ -237,6 +237,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
isChecked: configurationDTO.isTablet,
|
||||
onChanged: (value) {
|
||||
configurationDTO.isTablet = value;
|
||||
save(configurationDTO, appContext);
|
||||
},
|
||||
),
|
||||
CheckInputContainer(
|
||||
@ -246,6 +247,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
isChecked: configurationDTO.isMobile,
|
||||
onChanged: (value) {
|
||||
configurationDTO.isMobile = value;
|
||||
save(configurationDTO, appContext);
|
||||
},
|
||||
),
|
||||
if(configurationDTO.isMobile != null && configurationDTO.isMobile!)
|
||||
@ -404,7 +406,7 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
||||
{
|
||||
if(configurationDTO.isMobile!) {
|
||||
// Only see Article and Quizz type
|
||||
sections = new List<SectionDTO>.from(snapshot.data).where((section) => !section.isSubSection! && (section.type == SectionType.Article || section.type == SectionType.Quizz)).toList();
|
||||
sections = new List<SectionDTO>.from(snapshot.data).where((section) => !section.isSubSection! && (section.type == SectionType.Article || section.type == SectionType.Quiz)).toList();
|
||||
} else {
|
||||
sections = new List<SectionDTO>.from(snapshot.data).where((section) => !section.isSubSection!).toList();
|
||||
}
|
||||
|
||||
@ -23,6 +23,12 @@ class Client {
|
||||
DeviceApi? _deviceApi;
|
||||
DeviceApi? get deviceApi => _deviceApi;
|
||||
|
||||
SectionMapApi? _sectionMapApi;
|
||||
SectionMapApi? get sectionMapApi => _sectionMapApi;
|
||||
|
||||
SectionQuizApi? _sectionQuizApi;
|
||||
SectionQuizApi? get sectionQuizApi => _sectionQuizApi;
|
||||
|
||||
Client(String path) {
|
||||
_apiClient = ApiClient(
|
||||
basePath: path);
|
||||
@ -35,5 +41,7 @@ class Client {
|
||||
_sectionApi = SectionApi(_apiClient);
|
||||
_resourceApi = ResourceApi(_apiClient);
|
||||
_deviceApi = DeviceApi(_apiClient);
|
||||
_sectionMapApi = SectionMapApi(_apiClient);
|
||||
_sectionQuizApi = SectionQuizApi(_apiClient);
|
||||
}
|
||||
}
|
||||
@ -32,7 +32,7 @@ class CategorieDTO {
|
||||
|
||||
String? icon;
|
||||
|
||||
ContentDTOResource? resourceDTO;
|
||||
ResourceDTO? resourceDTO;
|
||||
|
||||
int? order;
|
||||
|
||||
@ -113,7 +113,7 @@ class CategorieDTO {
|
||||
id: mapValueOfType<int>(json, r'id'),
|
||||
label: TranslationDTO.listFromJson(json[r'label']),
|
||||
icon: mapValueOfType<String>(json, r'icon'),
|
||||
resourceDTO: ContentDTOResource.fromJson(json[r'resourceDTO']),
|
||||
resourceDTO: ResourceDTO.fromJson(json[r'resourceDTO']),
|
||||
order: mapValueOfType<int>(json, r'order'),
|
||||
);
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
part of openapi.api;
|
||||
|
||||
/// 0 = Map 1 = Slider 2 = Video 3 = Web 4 = Menu 5 = Quizz 6 = Article 7 = PDF 8 = Puzzle 9 = Agenda
|
||||
/// 0 = Map 1 = Slider 2 = Video 3 = Web 4 = Menu 5 = Quiz 6 = Article 7 = PDF 8 = Puzzle 9 = Agenda
|
||||
class SectionType {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const SectionType._(this.value);
|
||||
@ -28,7 +28,7 @@ class SectionType {
|
||||
static const Video = SectionType._(2);
|
||||
static const Web = SectionType._(3);
|
||||
static const Menu = SectionType._(4);
|
||||
static const Quizz = SectionType._(5);
|
||||
static const Quiz = SectionType._(5);
|
||||
static const Article = SectionType._(6);
|
||||
static const Pdf = SectionType._(7);
|
||||
static const Puzzle = SectionType._(8);
|
||||
@ -42,7 +42,7 @@ class SectionType {
|
||||
Video,
|
||||
Web,
|
||||
Menu,
|
||||
Quizz,
|
||||
Quiz,
|
||||
Article,
|
||||
Pdf,
|
||||
Puzzle,
|
||||
@ -92,7 +92,7 @@ class SectionTypeTypeTransformer {
|
||||
case r'Video': return SectionType.Video;
|
||||
case r'Web': return SectionType.Web;
|
||||
case r'Menu': return SectionType.Menu;
|
||||
case r'Quizz': return SectionType.Quizz;
|
||||
case r'Quiz': return SectionType.Quiz;
|
||||
case r'Article': return SectionType.Article;
|
||||
case r'PDF': return SectionType.Pdf;
|
||||
case r'Puzzle': return SectionType.Puzzle;
|
||||
@ -111,7 +111,7 @@ class SectionTypeTypeTransformer {
|
||||
case 2: return SectionType.Video;
|
||||
case 3: return SectionType.Web;
|
||||
case 4: return SectionType.Menu;
|
||||
case 5: return SectionType.Quizz;
|
||||
case 5: return SectionType.Quiz;
|
||||
case 6: return SectionType.Article;
|
||||
case 7: return SectionType.Pdf;
|
||||
case 8: return SectionType.Puzzle;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user