Fix agenda + update visu map (main params) + update wip config detail view
This commit is contained in:
parent
e05e5234c8
commit
de3f89e038
@ -35,7 +35,7 @@ class _AgendaConfigState extends State<AgendaConfig> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
//Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
var mapProviderIn = "";
|
var mapProviderIn = "";
|
||||||
switch (agendaDTO.agendaMapProvider) {
|
switch (agendaDTO.agendaMapProvider) {
|
||||||
@ -52,73 +52,21 @@ class _AgendaConfigState extends State<AgendaConfig> {
|
|||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
_buildAgendaHeader(size, mapProviderIn),
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
CheckInputContainer(
|
|
||||||
label: "En ligne :",
|
|
||||||
isChecked: agendaDTO.isOnlineAgenda ?? true,
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
agendaDTO.isOnlineAgenda = value;
|
|
||||||
widget.onChanged(agendaDTO);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SingleSelectContainer(
|
|
||||||
label: "Service carte :",
|
|
||||||
color: Colors.black,
|
|
||||||
initialValue: mapProviderIn,
|
|
||||||
inputValues: ["Google", "MapBox"],
|
|
||||||
onChanged: (String value) {
|
|
||||||
setState(() {
|
|
||||||
switch (value) {
|
|
||||||
case "Google":
|
|
||||||
agendaDTO.agendaMapProvider = MapProvider.Google;
|
|
||||||
break;
|
|
||||||
case "MapBox":
|
|
||||||
agendaDTO.agendaMapProvider = MapProvider.MapBox;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
widget.onChanged(agendaDTO);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (agendaDTO.isOnlineAgenda == true)
|
|
||||||
MultiStringInputContainer(
|
|
||||||
label: "Fichiers json :",
|
|
||||||
resourceTypes: [ResourceType.Json, ResourceType.JsonUrl],
|
|
||||||
modalLabel: "JSON",
|
|
||||||
color: kPrimaryColor,
|
|
||||||
initialValue: agendaDTO.resourceIds ?? [],
|
|
||||||
isTitle: false,
|
|
||||||
onGetResult: (value) {
|
|
||||||
setState(() {
|
|
||||||
agendaDTO.resourceIds = value;
|
|
||||||
widget.onChanged(agendaDTO);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
maxLines: 1,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (agendaDTO.isOnlineAgenda == false) ...[
|
if (agendaDTO.isOnlineAgenda == false) ...[
|
||||||
Divider(),
|
const Divider(height: 32),
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text("Évènements Manuels",
|
const Text("Évènements Manuels",
|
||||||
style:
|
style:
|
||||||
TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
|
||||||
ElevatedButton.icon(
|
ElevatedButton.icon(
|
||||||
icon: Icon(Icons.add),
|
icon: const Icon(Icons.add),
|
||||||
label: Text("Ajouter un évènement"),
|
label: const Text("Ajouter un évènement"),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showNewOrUpdateEventAgenda(
|
showNewOrUpdateEventAgenda(
|
||||||
context,
|
context,
|
||||||
@ -136,14 +84,22 @@ class _AgendaConfigState extends State<AgendaConfig> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
backgroundColor: kSuccess, foregroundColor: kWhite),
|
backgroundColor: kSuccess,
|
||||||
|
foregroundColor: kWhite,
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16, vertical: 12),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Container(
|
||||||
|
height: 600,
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
child: (agendaDTO.events == null || agendaDTO.events!.isEmpty)
|
child: (agendaDTO.events == null || agendaDTO.events!.isEmpty)
|
||||||
? Center(
|
? const Center(
|
||||||
child: Text("Aucun évènement manuel",
|
child: Text("Aucun évènement manuel",
|
||||||
style: TextStyle(fontStyle: FontStyle.italic)))
|
style: TextStyle(fontStyle: FontStyle.italic)))
|
||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
@ -151,21 +107,38 @@ class _AgendaConfigState extends State<AgendaConfig> {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final event = agendaDTO.events![index];
|
final event = agendaDTO.events![index];
|
||||||
return Card(
|
return Card(
|
||||||
margin:
|
elevation: 2,
|
||||||
EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
margin: const EdgeInsets.symmetric(
|
||||||
|
horizontal: 16, vertical: 6),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(12)),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
title: Text(event.label
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
?.firstWhere((t) => t.language == 'FR',
|
horizontal: 16, vertical: 8),
|
||||||
orElse: () => event.label![0])
|
leading: CircleAvatar(
|
||||||
.value ??
|
backgroundColor: kPrimaryColor.withOpacity(0.1),
|
||||||
"Évènement $index"),
|
child:
|
||||||
subtitle:
|
const Icon(Icons.event, color: kPrimaryColor),
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
(event.label != null && event.label!.isNotEmpty)
|
||||||
|
? (event.label!.firstWhere(
|
||||||
|
(t) => t.language == 'FR',
|
||||||
|
orElse: () => event.label![0])).value!
|
||||||
|
: "Évènement $index",
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
subtitle: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 4),
|
||||||
|
child:
|
||||||
Text(event.address?.address ?? "Pas d'adresse"),
|
Text(event.address?.address ?? "Pas d'adresse"),
|
||||||
|
),
|
||||||
trailing: Row(
|
trailing: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.edit, color: kPrimaryColor),
|
icon: const Icon(Icons.edit,
|
||||||
|
color: kPrimaryColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showNewOrUpdateEventAgenda(
|
showNewOrUpdateEventAgenda(
|
||||||
context,
|
context,
|
||||||
@ -181,7 +154,7 @@ class _AgendaConfigState extends State<AgendaConfig> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.delete, color: kError),
|
icon: const Icon(Icons.delete, color: kError),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
agendaDTO.events!.removeAt(index);
|
agendaDTO.events!.removeAt(index);
|
||||||
@ -200,4 +173,74 @@ class _AgendaConfigState extends State<AgendaConfig> {
|
|||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildAgendaHeader(Size size, String mapProviderIn) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.1),
|
||||||
|
spreadRadius: 2,
|
||||||
|
blurRadius: 5,
|
||||||
|
offset: const Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
border: Border.all(color: kPrimaryColor.withOpacity(0.2)),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
CheckInputContainer(
|
||||||
|
label: "En ligne :",
|
||||||
|
isChecked: agendaDTO.isOnlineAgenda ?? true,
|
||||||
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
agendaDTO.isOnlineAgenda = value;
|
||||||
|
widget.onChanged(agendaDTO);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SingleSelectContainer(
|
||||||
|
label: "Service carte :",
|
||||||
|
color: Colors.black,
|
||||||
|
initialValue: mapProviderIn,
|
||||||
|
inputValues: const ["Google", "MapBox"],
|
||||||
|
onChanged: (String value) {
|
||||||
|
setState(() {
|
||||||
|
switch (value) {
|
||||||
|
case "Google":
|
||||||
|
agendaDTO.agendaMapProvider = MapProvider.Google;
|
||||||
|
break;
|
||||||
|
case "MapBox":
|
||||||
|
agendaDTO.agendaMapProvider = MapProvider.MapBox;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
widget.onChanged(agendaDTO);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (agendaDTO.isOnlineAgenda == true)
|
||||||
|
MultiStringInputContainer(
|
||||||
|
label: "Fichiers json :",
|
||||||
|
resourceTypes: const [ResourceType.Json, ResourceType.JsonUrl],
|
||||||
|
modalLabel: "JSON",
|
||||||
|
color: kPrimaryColor,
|
||||||
|
initialValue: agendaDTO.resourceIds ?? [],
|
||||||
|
isTitle: false,
|
||||||
|
onGetResult: (value) {
|
||||||
|
setState(() {
|
||||||
|
agendaDTO.resourceIds = value;
|
||||||
|
widget.onChanged(agendaDTO);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,9 +93,8 @@ class _GameConfigState extends State<GameConfig> {
|
|||||||
Tab(icon: Icon(Icons.door_front_door), text: "Escape Game"),
|
Tab(icon: Icon(Icons.door_front_door), text: "Escape Game"),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
Container(
|
||||||
child: Container(
|
height: 650,
|
||||||
height: 500,
|
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
children: [
|
children: [
|
||||||
_buildPuzzleConfig(),
|
_buildPuzzleConfig(),
|
||||||
@ -115,7 +114,6 @@ class _GameConfigState extends State<GameConfig> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -130,6 +130,7 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
_buildMapHeader(size, mapProviderIn),
|
||||||
TabBar(
|
TabBar(
|
||||||
labelColor: kPrimaryColor,
|
labelColor: kPrimaryColor,
|
||||||
unselectedLabelColor: Colors.grey,
|
unselectedLabelColor: Colors.grey,
|
||||||
@ -140,151 +141,13 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
height: 500, // Reduced from 550 to 500 to avoid 8.5px overflow
|
height: 700,
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
children: [
|
children: [
|
||||||
// Tab 1: Configuration & Points
|
// Tab 1: Configuration & Points
|
||||||
SingleChildScrollView(
|
SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
|
||||||
height: size.height * 0.25,
|
|
||||||
width: double.infinity,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
SingleSelectContainer(
|
|
||||||
label: "Service :",
|
|
||||||
color: Colors.black,
|
|
||||||
initialValue: mapProviderIn,
|
|
||||||
inputValues: map_providers,
|
|
||||||
onChanged: (String value) {
|
|
||||||
switch (value) {
|
|
||||||
case "Google":
|
|
||||||
mapDTO.mapProvider =
|
|
||||||
MapProvider.Google;
|
|
||||||
break;
|
|
||||||
case "MapBox":
|
|
||||||
mapDTO.mapProvider =
|
|
||||||
MapProvider.MapBox;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
widget.onChanged(mapDTO);
|
|
||||||
}),
|
|
||||||
GeolocInputContainer(
|
|
||||||
label: "Point de centrage:",
|
|
||||||
initialValue:
|
|
||||||
mapDTO.centerLatitude != null &&
|
|
||||||
mapDTO.centerLongitude != null
|
|
||||||
? LatLong(
|
|
||||||
double.parse(
|
|
||||||
mapDTO.centerLatitude!),
|
|
||||||
double.parse(
|
|
||||||
mapDTO.centerLongitude!))
|
|
||||||
: null,
|
|
||||||
color: kPrimaryColor,
|
|
||||||
onChanged: (LatLong? localisation) {
|
|
||||||
if (localisation != null) {
|
|
||||||
mapDTO.centerLongitude =
|
|
||||||
localisation.longitude.toString();
|
|
||||||
mapDTO.centerLatitude =
|
|
||||||
localisation.latitude.toString();
|
|
||||||
}
|
|
||||||
widget.onChanged(mapDTO);
|
|
||||||
},
|
|
||||||
isSmall: true),
|
|
||||||
ResourceInputContainer(
|
|
||||||
label: "Icône:",
|
|
||||||
initialValue: mapDTO.iconResourceId,
|
|
||||||
color: kPrimaryColor,
|
|
||||||
imageFit: BoxFit.contain,
|
|
||||||
onChanged: (ResourceDTO resource) {
|
|
||||||
if (resource.id == null) {
|
|
||||||
mapDTO.iconSource = null;
|
|
||||||
mapDTO.iconResourceId = null;
|
|
||||||
} else {
|
|
||||||
mapDTO.iconResourceId = resource.id;
|
|
||||||
mapDTO.iconSource = resource.url;
|
|
||||||
}
|
|
||||||
widget.onChanged(mapDTO);
|
|
||||||
},
|
|
||||||
isSmall: true),
|
|
||||||
]),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
children: [
|
|
||||||
if (mapDTO.mapProvider == MapProvider.Google)
|
|
||||||
DropDownInputContainer(
|
|
||||||
label: "Type:",
|
|
||||||
values: map_types,
|
|
||||||
initialValue: mapType,
|
|
||||||
onChange: (String? value) {
|
|
||||||
mapDTO.mapType =
|
|
||||||
MapTypeApp.fromJson(value);
|
|
||||||
widget.onChanged(mapDTO);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (mapDTO.mapProvider == MapProvider.MapBox)
|
|
||||||
DropDownInputContainer(
|
|
||||||
label: "Type:",
|
|
||||||
values: map_types_mapBox,
|
|
||||||
initialValue: mapTypeMapBox,
|
|
||||||
onChange: (String? value) {
|
|
||||||
mapDTO.mapTypeMapbox =
|
|
||||||
MapTypeMapBox.fromJson(value);
|
|
||||||
widget.onChanged(mapDTO);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SliderInputContainer(
|
|
||||||
label: "Zoom:",
|
|
||||||
initialValue: mapDTO.zoom != null
|
|
||||||
? mapDTO.zoom!.toDouble()
|
|
||||||
: 18,
|
|
||||||
color: kPrimaryColor,
|
|
||||||
min: 0,
|
|
||||||
max: 30,
|
|
||||||
onChanged: (double value) {
|
|
||||||
mapDTO.zoom = value.toInt();
|
|
||||||
widget.onChanged(mapDTO);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
height: 70,
|
|
||||||
child: CategoryInputContainer(
|
|
||||||
label: "Catégories :",
|
|
||||||
initialValue: mapDTO.categories != null
|
|
||||||
? mapDTO.categories!
|
|
||||||
: [],
|
|
||||||
color: kPrimaryColor,
|
|
||||||
onChanged: (List<CategorieDTO>? value) {
|
|
||||||
if (value != null) {
|
|
||||||
mapDTO.categories = value;
|
|
||||||
if (mapDTO.points != null) {
|
|
||||||
mapDTO.points!.forEach((p) {
|
|
||||||
if (p.categorieId != null &&
|
|
||||||
!mapDTO.categories!
|
|
||||||
.map((c) => c.id)
|
|
||||||
.any((e) =>
|
|
||||||
e != null &&
|
|
||||||
e == p.categorieId)) {
|
|
||||||
p.categorieId = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
widget.onChanged(mapDTO);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: getGeoPoints(
|
future: getGeoPoints(
|
||||||
(appContext.getContext() as ManagerAppContext)
|
(appContext.getContext() as ManagerAppContext)
|
||||||
@ -533,18 +396,12 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
}, appContext, context);
|
}, appContext, context);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: MediaQuery.of(context)
|
height: 40,
|
||||||
.size
|
width: 40,
|
||||||
.width *
|
|
||||||
0.04,
|
|
||||||
width: MediaQuery.of(context)
|
|
||||||
.size
|
|
||||||
.width *
|
|
||||||
0.04,
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.add,
|
Icons.add,
|
||||||
color: kTextLightColor,
|
color: kTextLightColor,
|
||||||
size: 30.0,
|
size: 25.0,
|
||||||
),
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: kSuccess,
|
color: kSuccess,
|
||||||
@ -727,6 +584,146 @@ class _MapConfigState extends State<MapConfig> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildMapHeader(Size size, String mapProviderIn) {
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(15),
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.grey.withOpacity(0.1),
|
||||||
|
spreadRadius: 2,
|
||||||
|
blurRadius: 5,
|
||||||
|
offset: Offset(0, 3),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
border: Border.all(color: kPrimaryColor.withOpacity(0.2)),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
SingleSelectContainer(
|
||||||
|
label: "Service :",
|
||||||
|
color: Colors.black,
|
||||||
|
initialValue: mapProviderIn,
|
||||||
|
inputValues: map_providers,
|
||||||
|
onChanged: (String value) {
|
||||||
|
switch (value) {
|
||||||
|
case "Google":
|
||||||
|
mapDTO.mapProvider = MapProvider.Google;
|
||||||
|
break;
|
||||||
|
case "MapBox":
|
||||||
|
mapDTO.mapProvider = MapProvider.MapBox;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
widget.onChanged(mapDTO);
|
||||||
|
}),
|
||||||
|
GeolocInputContainer(
|
||||||
|
label: "Point de centrage :",
|
||||||
|
initialValue: mapDTO.centerLatitude != null &&
|
||||||
|
mapDTO.centerLongitude != null
|
||||||
|
? LatLong(double.parse(mapDTO.centerLatitude!),
|
||||||
|
double.parse(mapDTO.centerLongitude!))
|
||||||
|
: null,
|
||||||
|
color: kPrimaryColor,
|
||||||
|
onChanged: (LatLong? localisation) {
|
||||||
|
if (localisation != null) {
|
||||||
|
mapDTO.centerLongitude =
|
||||||
|
localisation.longitude.toString();
|
||||||
|
mapDTO.centerLatitude = localisation.latitude.toString();
|
||||||
|
}
|
||||||
|
widget.onChanged(mapDTO);
|
||||||
|
},
|
||||||
|
isSmall: true),
|
||||||
|
ResourceInputContainer(
|
||||||
|
label: "Icône :",
|
||||||
|
initialValue: mapDTO.iconResourceId,
|
||||||
|
color: kPrimaryColor,
|
||||||
|
imageFit: BoxFit.contain,
|
||||||
|
onChanged: (ResourceDTO resource) {
|
||||||
|
if (resource.id == null) {
|
||||||
|
mapDTO.iconSource = null;
|
||||||
|
mapDTO.iconResourceId = null;
|
||||||
|
} else {
|
||||||
|
mapDTO.iconResourceId = resource.id;
|
||||||
|
mapDTO.iconSource = resource.url;
|
||||||
|
}
|
||||||
|
widget.onChanged(mapDTO);
|
||||||
|
},
|
||||||
|
isSmall: true),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
if (mapDTO.mapProvider == MapProvider.Google)
|
||||||
|
DropDownInputContainer(
|
||||||
|
label: "Type :",
|
||||||
|
values: map_types,
|
||||||
|
initialValue: mapType,
|
||||||
|
onChange: (String? value) {
|
||||||
|
mapDTO.mapType = MapTypeApp.fromJson(value);
|
||||||
|
widget.onChanged(mapDTO);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (mapDTO.mapProvider == MapProvider.MapBox)
|
||||||
|
DropDownInputContainer(
|
||||||
|
label: "Type :",
|
||||||
|
values: map_types_mapBox,
|
||||||
|
initialValue: mapTypeMapBox,
|
||||||
|
onChange: (String? value) {
|
||||||
|
mapDTO.mapTypeMapbox = MapTypeMapBox.fromJson(value);
|
||||||
|
widget.onChanged(mapDTO);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SliderInputContainer(
|
||||||
|
label: "Zoom :",
|
||||||
|
initialValue:
|
||||||
|
mapDTO.zoom != null ? mapDTO.zoom!.toDouble() : 18,
|
||||||
|
color: kPrimaryColor,
|
||||||
|
min: 0,
|
||||||
|
max: 30,
|
||||||
|
onChanged: (double value) {
|
||||||
|
mapDTO.zoom = value.toInt();
|
||||||
|
widget.onChanged(mapDTO);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 70,
|
||||||
|
child: CategoryInputContainer(
|
||||||
|
label: "Catégories :",
|
||||||
|
initialValue:
|
||||||
|
mapDTO.categories != null ? mapDTO.categories! : [],
|
||||||
|
color: kPrimaryColor,
|
||||||
|
onChanged: (List<CategorieDTO>? value) {
|
||||||
|
if (value != null) {
|
||||||
|
mapDTO.categories = value;
|
||||||
|
if (mapDTO.points != null) {
|
||||||
|
mapDTO.points!.forEach((p) {
|
||||||
|
if (p.categorieId != null &&
|
||||||
|
!mapDTO.categories!.map((c) => c.id).any(
|
||||||
|
(e) => e != null && e == p.categorieId)) {
|
||||||
|
p.categorieId = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
widget.onChanged(mapDTO);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boxDecoration(GeoPointDTO geoPointDTO, appContext) {
|
boxDecoration(GeoPointDTO geoPointDTO, appContext) {
|
||||||
|
|||||||
@ -51,7 +51,8 @@ class SectionDetailScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
||||||
late SectionDTO sectionDTO;
|
late SectionDTO sectionDTO;
|
||||||
late Object sectionDetailDTO;
|
Object? sectionDetailDTO;
|
||||||
|
String? lastLoadedSectionId;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -72,6 +73,14 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
|
|
||||||
if (nullableSection != null) {
|
if (nullableSection != null) {
|
||||||
sectionDTO = nullableSection;
|
sectionDTO = nullableSection;
|
||||||
|
|
||||||
|
// Only initialize sectionDetailDTO if it's not already loaded for this section
|
||||||
|
if (sectionDetailDTO == null ||
|
||||||
|
lastLoadedSectionId != widget.id) {
|
||||||
|
_initializeSectionDetail(rawSectionData);
|
||||||
|
lastLoadedSectionId = widget.id;
|
||||||
|
}
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
children: [
|
children: [
|
||||||
bodySection(
|
bodySection(
|
||||||
@ -344,7 +353,6 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
), // FIELDS SECTION
|
), // FIELDS SECTION
|
||||||
Container(
|
Container(
|
||||||
//width: size.width * 0.8,
|
//width: size.width * 0.8,
|
||||||
height: size.height * 0.5,
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: getSpecificData(rawSectionDTO, appContext),
|
child: getSpecificData(rawSectionDTO, appContext),
|
||||||
@ -439,7 +447,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
var sectionResult = await (appContext.getContext() as ManagerAppContext)
|
var sectionResult = await (appContext.getContext() as ManagerAppContext)
|
||||||
.clientAPI!
|
.clientAPI!
|
||||||
.sectionApi!
|
.sectionApi!
|
||||||
.sectionUpdate(sectionDetailDTO);
|
.sectionUpdate(sectionDetailDTO!);
|
||||||
SectionDTO? section = SectionDTO.fromJson(sectionResult);
|
SectionDTO? section = SectionDTO.fromJson(sectionResult);
|
||||||
|
|
||||||
ManagerAppContext managerAppContext = appContext.getContext();
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
@ -462,111 +470,88 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
getSpecificData(Object? rawSectionData, AppContext appContext) {
|
getSpecificData(Object? rawSectionData, AppContext appContext) {
|
||||||
switch (sectionDTO.type) {
|
switch (sectionDTO.type) {
|
||||||
case SectionType.Map:
|
case SectionType.Map:
|
||||||
MapDTO mapDTO = MapDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = mapDTO;
|
|
||||||
return MapConfig(
|
return MapConfig(
|
||||||
initialValue: mapDTO,
|
initialValue: sectionDetailDTO as MapDTO,
|
||||||
onChanged: (MapDTO changedMap) {
|
onChanged: (MapDTO changedMap) {
|
||||||
sectionDetailDTO = changedMap;
|
sectionDetailDTO = changedMap;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Slider:
|
case SectionType.Slider:
|
||||||
SliderDTO sliderDTO = SliderDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = sliderDTO;
|
|
||||||
return SliderConfig(
|
return SliderConfig(
|
||||||
initialValue: sliderDTO,
|
initialValue: sectionDetailDTO as SliderDTO,
|
||||||
onChanged: (SliderDTO changedSlider) {
|
onChanged: (SliderDTO changedSlider) {
|
||||||
sectionDetailDTO = changedSlider;
|
sectionDetailDTO = changedSlider;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Video:
|
case SectionType.Video:
|
||||||
VideoDTO videoDTO = VideoDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = videoDTO;
|
|
||||||
return VideoConfig(
|
return VideoConfig(
|
||||||
label: "Url de la vidéo:",
|
label: "Url de la vidéo:",
|
||||||
initialValue: videoDTO,
|
initialValue: sectionDetailDTO as VideoDTO,
|
||||||
onChanged: (VideoDTO updatedWebDTO) {
|
onChanged: (VideoDTO updatedWebDTO) {
|
||||||
sectionDetailDTO = updatedWebDTO;
|
sectionDetailDTO = updatedWebDTO;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Web:
|
case SectionType.Web:
|
||||||
WebDTO webDTO = WebDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = webDTO;
|
|
||||||
return WebConfig(
|
return WebConfig(
|
||||||
label: "Url du site web:",
|
label: "Url du site web:",
|
||||||
initialValue: webDTO,
|
initialValue: sectionDetailDTO as WebDTO,
|
||||||
onChanged: (WebDTO updatedWebDTO) {
|
onChanged: (WebDTO updatedWebDTO) {
|
||||||
sectionDetailDTO = updatedWebDTO;
|
sectionDetailDTO = updatedWebDTO;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Menu:
|
case SectionType.Menu:
|
||||||
MenuDTO menuDTO = MenuDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = menuDTO;
|
|
||||||
return MenuConfig(
|
return MenuConfig(
|
||||||
initialValue: menuDTO,
|
initialValue: sectionDetailDTO as MenuDTO,
|
||||||
onChanged: (String data) {
|
onChanged: (String data) {
|
||||||
//sectionDTO.data = data;
|
//sectionDTO.data = data;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Quiz:
|
case SectionType.Quiz:
|
||||||
QuizDTO quizDTO = QuizDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = quizDTO;
|
|
||||||
return QuizzConfig(
|
return QuizzConfig(
|
||||||
initialValue: quizDTO,
|
initialValue: sectionDetailDTO as QuizDTO,
|
||||||
onChanged: (QuizDTO updatedQuiz) {
|
onChanged: (QuizDTO updatedQuiz) {
|
||||||
sectionDetailDTO = updatedQuiz;
|
sectionDetailDTO = updatedQuiz;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Article:
|
case SectionType.Article:
|
||||||
ArticleDTO articleDTO = ArticleDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = articleDTO;
|
|
||||||
return ArticleConfig(
|
return ArticleConfig(
|
||||||
initialValue: articleDTO,
|
initialValue: sectionDetailDTO as ArticleDTO,
|
||||||
onChanged: (ArticleDTO changedArticle) {
|
onChanged: (ArticleDTO changedArticle) {
|
||||||
sectionDetailDTO = changedArticle;
|
sectionDetailDTO = changedArticle;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Pdf:
|
case SectionType.Pdf:
|
||||||
PdfDTO pdfDTO = PdfDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = pdfDTO;
|
|
||||||
return PDFConfig(
|
return PDFConfig(
|
||||||
initialValue: pdfDTO,
|
initialValue: sectionDetailDTO as PdfDTO,
|
||||||
onChanged: (PdfDTO changedPDF) {
|
onChanged: (PdfDTO changedPDF) {
|
||||||
sectionDetailDTO = changedPDF;
|
sectionDetailDTO = changedPDF;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Game:
|
case SectionType.Game:
|
||||||
GameDTO gameDTO = GameDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = gameDTO;
|
|
||||||
return GameConfig(
|
return GameConfig(
|
||||||
initialValue: gameDTO,
|
key: ValueKey(sectionDTO.id),
|
||||||
|
initialValue: sectionDetailDTO as GameDTO,
|
||||||
onChanged: (GameDTO updatedGame) {
|
onChanged: (GameDTO updatedGame) {
|
||||||
sectionDetailDTO = updatedGame;
|
sectionDetailDTO = updatedGame;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Agenda:
|
case SectionType.Agenda:
|
||||||
AgendaDTO agendaDTO = AgendaDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = agendaDTO;
|
|
||||||
return AgendaConfig(
|
return AgendaConfig(
|
||||||
initialValue: agendaDTO,
|
initialValue: sectionDetailDTO as AgendaDTO,
|
||||||
onChanged: (AgendaDTO updatedAgenda) {
|
onChanged: (AgendaDTO updatedAgenda) {
|
||||||
sectionDetailDTO = updatedAgenda;
|
sectionDetailDTO = updatedAgenda;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Weather:
|
case SectionType.Weather:
|
||||||
WeatherDTO weatherDTO = WeatherDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = weatherDTO;
|
|
||||||
return WeatherConfig(
|
return WeatherConfig(
|
||||||
initialValue: weatherDTO,
|
initialValue: sectionDetailDTO as WeatherDTO,
|
||||||
onChanged: (WeatherDTO updatedWeather) {
|
onChanged: (WeatherDTO updatedWeather) {
|
||||||
sectionDetailDTO = updatedWeather;
|
sectionDetailDTO = updatedWeather;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
case SectionType.Event:
|
case SectionType.Event:
|
||||||
SectionEventDTO eventDTO = SectionEventDTO.fromJson(rawSectionData)!;
|
|
||||||
sectionDetailDTO = eventDTO;
|
|
||||||
return EventConfig(
|
return EventConfig(
|
||||||
initialValue: eventDTO,
|
initialValue: sectionDetailDTO as SectionEventDTO,
|
||||||
onChanged: (SectionEventDTO updatedEvent) {
|
onChanged: (SectionEventDTO updatedEvent) {
|
||||||
sectionDetailDTO = updatedEvent;
|
sectionDetailDTO = updatedEvent;
|
||||||
},
|
},
|
||||||
@ -574,6 +559,48 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_initializeSectionDetail(Object? rawSectionData) {
|
||||||
|
if (rawSectionData == null) return;
|
||||||
|
switch (sectionDTO.type) {
|
||||||
|
case SectionType.Map:
|
||||||
|
sectionDetailDTO = MapDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Slider:
|
||||||
|
sectionDetailDTO = SliderDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Video:
|
||||||
|
sectionDetailDTO = VideoDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Web:
|
||||||
|
sectionDetailDTO = WebDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Menu:
|
||||||
|
sectionDetailDTO = MenuDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Quiz:
|
||||||
|
sectionDetailDTO = QuizDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Article:
|
||||||
|
sectionDetailDTO = ArticleDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Pdf:
|
||||||
|
sectionDetailDTO = PdfDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Game:
|
||||||
|
sectionDetailDTO = GameDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Agenda:
|
||||||
|
sectionDetailDTO = AgendaDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Weather:
|
||||||
|
sectionDetailDTO = WeatherDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
case SectionType.Event:
|
||||||
|
sectionDetailDTO = SectionEventDTO.fromJson(rawSectionData)!;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
updateSectionDetail() {
|
updateSectionDetail() {
|
||||||
switch (sectionDTO.type) {
|
switch (sectionDTO.type) {
|
||||||
case SectionType.Map:
|
case SectionType.Map:
|
||||||
|
|||||||
@ -157,16 +157,15 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
|||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
LayoutBuilder(
|
||||||
child: Row(
|
builder: (context, constraints) {
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
final isWide = constraints.maxWidth > 700;
|
||||||
children: [
|
|
||||||
Column(
|
final fields = Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 100,
|
height: 70,
|
||||||
child: StringInputContainer(
|
child: StringInputContainer(
|
||||||
label: "Identifiant :",
|
label: "Identifiant :",
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
@ -177,6 +176,11 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Wrap(
|
||||||
|
spacing: 24,
|
||||||
|
runSpacing: 8,
|
||||||
|
crossAxisAlignment: WrapCrossAlignment.center,
|
||||||
|
children: [
|
||||||
MultiSelectDropdownLanguageContainer(
|
MultiSelectDropdownLanguageContainer(
|
||||||
label: "Langues :",
|
label: "Langues :",
|
||||||
initialValue: configurationDTO.languages != null ? configurationDTO.languages! : [],
|
initialValue: configurationDTO.languages != null ? configurationDTO.languages! : [],
|
||||||
@ -187,7 +191,38 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
|||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
var tempOutput = new List<String>.from(value);
|
var tempOutput = new List<String>.from(value);
|
||||||
configurationDTO.languages = tempOutput;
|
configurationDTO.languages = tempOutput;
|
||||||
//print(configurationDTO.languages);
|
},
|
||||||
|
),
|
||||||
|
CheckInputContainer(
|
||||||
|
icon: Icons.signal_wifi_off,
|
||||||
|
label: "Hors ligne :",
|
||||||
|
fontSize: 20,
|
||||||
|
isChecked: configurationDTO.isOffline,
|
||||||
|
onChanged: (value) {
|
||||||
|
configurationDTO.isOffline = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
final images = Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ResourceInputContainer(
|
||||||
|
label: "Image fond d'écran :",
|
||||||
|
fontSize: 20,
|
||||||
|
initialValue: configurationDTO.imageId,
|
||||||
|
color: kPrimaryColor,
|
||||||
|
onChanged: (ResourceDTO resource) {
|
||||||
|
if (resource.id == null) {
|
||||||
|
configurationDTO.imageId = null;
|
||||||
|
configurationDTO.imageSource = null;
|
||||||
|
} else {
|
||||||
|
configurationDTO.imageId = resource.id;
|
||||||
|
configurationDTO.imageSource = resource.url;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ResourceInputContainer(
|
ResourceInputContainer(
|
||||||
@ -205,22 +240,48 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
/*if(configurationDTO.isTablet!)
|
|
||||||
CheckInputContainer(
|
|
||||||
icon: Icons.image,
|
|
||||||
label: "Fond pour les images des sections :",
|
|
||||||
fontSize: 20,
|
|
||||||
isChecked: configurationDTO.isSectionImageBackground,
|
|
||||||
onChanged: (value) {
|
|
||||||
configurationDTO.isSectionImageBackground = value;
|
|
||||||
},
|
|
||||||
),*/
|
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
if (isWide) {
|
||||||
|
return Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
Expanded(flex: 3, child: fields),
|
||||||
|
SizedBox(width: 24),
|
||||||
|
Expanded(flex: 2, child: images),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
child: StringInputContainer(
|
||||||
|
label: "Identifiant :",
|
||||||
|
fontSize: 20,
|
||||||
|
fontSizeText: 20,
|
||||||
|
initialValue: configurationDTO.label,
|
||||||
|
onChanged: (value) {
|
||||||
|
configurationDTO.label = value;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
MultiSelectDropdownLanguageContainer(
|
||||||
|
label: "Langues :",
|
||||||
|
initialValue: configurationDTO.languages != null ? configurationDTO.languages! : [],
|
||||||
|
values: languages,
|
||||||
|
isMultiple: true,
|
||||||
|
fontSize: 20,
|
||||||
|
isAtLeastOne: true,
|
||||||
|
onChanged: (value) {
|
||||||
|
var tempOutput = new List<String>.from(value);
|
||||||
|
configurationDTO.languages = tempOutput;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
SizedBox(height: 8),
|
||||||
CheckInputContainer(
|
CheckInputContainer(
|
||||||
icon: Icons.signal_wifi_off,
|
icon: Icons.signal_wifi_off,
|
||||||
label: "Hors ligne :",
|
label: "Hors ligne :",
|
||||||
@ -230,154 +291,12 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
|||||||
configurationDTO.isOffline = value;
|
configurationDTO.isOffline = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
/*CheckInputContainer(
|
SizedBox(height: 16),
|
||||||
icon: Icons.tablet,
|
images,
|
||||||
label: "Tablette :",
|
|
||||||
fontSize: 20,
|
|
||||||
isChecked: configurationDTO.isTablet,
|
|
||||||
onChanged: (value) {
|
|
||||||
configurationDTO.isTablet = value;
|
|
||||||
save(configurationDTO, appContext);
|
|
||||||
},
|
|
||||||
),*/
|
|
||||||
/*CheckInputContainer(
|
|
||||||
icon: Icons.phone_android,
|
|
||||||
label: "Mobile :",
|
|
||||||
fontSize: 20,
|
|
||||||
isChecked: configurationDTO.isMobile,
|
|
||||||
onChanged: (value) {
|
|
||||||
configurationDTO.isMobile = value;
|
|
||||||
save(configurationDTO, appContext);
|
|
||||||
},
|
|
||||||
),*/
|
|
||||||
/*if(configurationDTO.isMobile != null && configurationDTO.isMobile!)
|
|
||||||
RoundedButton(
|
|
||||||
text: "Télécharger les QRCodes",
|
|
||||||
icon: Icons.qr_code,
|
|
||||||
color: Colors.grey,
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontSize: 15,
|
|
||||||
press: () {
|
|
||||||
PDFHelper.downloadPDF(managerAppContext, sections!);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if(configurationDTO.isTablet!)
|
|
||||||
CheckInputContainer(
|
|
||||||
icon: Icons.date_range,
|
|
||||||
label: "Date :",
|
|
||||||
fontSize: 20,
|
|
||||||
isChecked: configurationDTO.isDate,
|
|
||||||
onChanged: (value) {
|
|
||||||
configurationDTO.isDate = value;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if(configurationDTO.isTablet!)
|
|
||||||
CheckInputContainer(
|
|
||||||
icon: Icons.watch_later_outlined,
|
|
||||||
label: "Heure :",
|
|
||||||
fontSize: 20,
|
|
||||||
isChecked: configurationDTO.isHour,
|
|
||||||
onChanged: (value) {
|
|
||||||
configurationDTO.isHour = value;
|
|
||||||
},
|
|
||||||
),*/
|
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
/*if(!configurationDTO.isMobile!)
|
|
||||||
ColorPickerInputContainer(
|
|
||||||
label: "Couleur fond d'écran :",
|
|
||||||
fontSize: 20,
|
|
||||||
color: configurationDTO.secondaryColor,
|
|
||||||
onChanged: (value) {
|
|
||||||
configurationDTO.secondaryColor = value;
|
|
||||||
},
|
|
||||||
),*/
|
|
||||||
/*if(!configurationDTO.isMobile!)
|
|
||||||
ColorPickerInputContainer(
|
|
||||||
label: "Couleur principale :",
|
|
||||||
fontSize: 20,
|
|
||||||
color: configurationDTO.primaryColor,
|
|
||||||
onChanged: (value) {
|
|
||||||
configurationDTO.primaryColor = value;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if(configurationDTO.isMobile!)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 15),
|
|
||||||
child: MultiStringInputContainer(
|
|
||||||
label: "Titre affiché:",
|
|
||||||
modalLabel: "Titre",
|
|
||||||
fontSize: 20,
|
|
||||||
isHTML: true,
|
|
||||||
color: kPrimaryColor,
|
|
||||||
initialValue: configurationDTO != null ? configurationDTO.title! : [],
|
|
||||||
onGetResult: (value) {
|
|
||||||
if (configurationDTO.title != value) {
|
|
||||||
configurationDTO.title = value;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
maxLines: 1,
|
|
||||||
isTitle: true,
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
ResourceInputContainer(
|
|
||||||
label: "Image fond d'écran :",
|
|
||||||
fontSize: 20,
|
|
||||||
initialValue: configurationDTO.imageId,
|
|
||||||
color: kPrimaryColor,
|
|
||||||
onChanged: (ResourceDTO resource) {
|
|
||||||
if(resource.id == null) {
|
|
||||||
configurationDTO.imageId = null;
|
|
||||||
configurationDTO.imageSource = null;
|
|
||||||
} else {
|
|
||||||
configurationDTO.imageId = resource.id;
|
|
||||||
configurationDTO.imageSource = resource.url;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
/*if(configurationDTO.isTablet!)
|
|
||||||
Container(
|
|
||||||
height: 100,
|
|
||||||
child: NumberInputContainer(
|
|
||||||
label: "Place des sections (%) :",
|
|
||||||
initialValue: configurationDTO.screenPercentageSectionsMainPage ?? 0,
|
|
||||||
isSmall: true,
|
|
||||||
maxLength: 3,
|
|
||||||
onChanged: (value) {
|
|
||||||
try {
|
|
||||||
configurationDTO.screenPercentageSectionsMainPage = int.parse(value);
|
|
||||||
} catch (e) {
|
|
||||||
print('Screen percentage value not a number');
|
|
||||||
showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if(configurationDTO.isTablet!)
|
|
||||||
Container(
|
|
||||||
height: 100,
|
|
||||||
child: NumberInputContainer(
|
|
||||||
label: "Pourcentage des arrondis (0-50) :",
|
|
||||||
initialValue: configurationDTO.roundedValue ?? 0,
|
|
||||||
isSmall: true,
|
|
||||||
maxLength: 2,
|
|
||||||
onChanged: (value) {
|
|
||||||
try {
|
|
||||||
configurationDTO.roundedValue = int.parse(value);
|
|
||||||
} catch (e) {
|
|
||||||
print('Rounded value not a number');
|
|
||||||
showNotification(Colors.orange, kWhite, 'Cela doit être un chiffre', context, null);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
])
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(20.0),
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user