Map details done + change translations modal

This commit is contained in:
Thomas Fransolet 2021-05-22 00:04:59 +02:00
parent 8990d0fcd6
commit 6037b287d7
17 changed files with 684 additions and 104 deletions

View File

@ -12,12 +12,14 @@ class ImageInputContainer extends StatefulWidget {
final String label;
final String initialValue;
final ValueChanged<ResourceDTO> onChanged;
final BoxFit imageFit;
const ImageInputContainer({
Key key,
this.color = kSecond,
this.label,
this.initialValue,
this.onChanged,
this.imageFit = BoxFit.cover,
}) : super(key: key);
@override
@ -123,9 +125,10 @@ class _ImageInputContainerState extends State<ImageInputContainer> {
boxDecoration(ResourceDetailDTO resourceDetailDTO, appContext) {
return BoxDecoration(
shape: BoxShape.rectangle,
color: kWhite,
borderRadius: BorderRadius.circular(30.0),
image: new DecorationImage(
fit: BoxFit.cover,
fit: widget.imageFit,
image: new NetworkImage(
resourceDetailDTO.type == ResourceType.image ? appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resourceDetailDTO.id : resourceDetailDTO.data,
),

View File

@ -1,29 +1,42 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/rounded_button.dart';
import 'package:manager_app/Components/string_input_container.dart';
import 'package:manager_app/Components/text_form_input_container.dart';
import 'package:manager_app/Components/translation_tab.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';
import 'package:collection/collection.dart';
import 'package:provider/provider.dart';
showMultiStringInput (String text, List<TranslationDTO> values, List<TranslationDTO> newValues, Function onGetResult, int maxLines, BuildContext context) { /*Function onSelect,*/
showMultiStringInput (String label, String modalLabel, List<TranslationDTO> values, List<TranslationDTO> newValues, Function onGetResult, int maxLines, BuildContext context) { /*Function onSelect,*/
showDialog(
builder: (BuildContext context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))
),
title: Text(text),
title: Center(child: Text(modalLabel)),
content: SingleChildScrollView(
child: Column(
children: [
Container(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: getTranslations(context, Provider.of<AppContext>(context), label, newValues),
),
),
),
/*Container(
width: 500,
height: 200,
child: TranslationTab(
translations: newValues,
maxLines: maxLines
)
),
),*/
/*Column(
children: showValues(newValues),
),*/
@ -72,6 +85,54 @@ showMultiStringInput (String text, List<TranslationDTO> values, List<Translation
), context: context
);
}
getTranslations(BuildContext context, AppContext appContext, String label, List<TranslationDTO> newValues) {
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.10,
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: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextFormInputContainer(
label: label,
color: kWhite,
isTitle: true,
initialValue: newValues.where((element) => element.language == language).first.value,
onChanged: (value) {
newValues.where((element) => element.language == language).first.value = value;
},
),
],
),
),
)
],
),
)
);
}
return translations;
}
/*
showValues(List<TranslationDTO> newValues) {
List<Widget> valuesToShow = new List<Widget>();

View File

@ -9,6 +9,7 @@ import 'package:managerapi/api.dart';
class MultiStringContainer extends StatelessWidget {
final Color color;
final String label;
final String modalLabel;
final List<TranslationDTO> initialValue;
final Function onGetResult;
final int maxLines;
@ -16,6 +17,7 @@ class MultiStringContainer extends StatelessWidget {
Key key,
this.color = kSecond,
this.label,
this.modalLabel,
this.initialValue,
this.onGetResult,
this.maxLines,
@ -43,7 +45,7 @@ class MultiStringContainer extends StatelessWidget {
initialValue.forEach((value) {
newValues.add(TranslationDTO.fromJson(jsonDecode(jsonEncode(value))));
});
showMultiStringInput(label, initialValue, newValues, onGetResult, maxLines, context);
showMultiStringInput(label, modalLabel, initialValue, newValues, onGetResult, maxLines, context);
},
child: Container(
decoration: BoxDecoration(

View File

@ -0,0 +1,63 @@
import 'package:flutter/material.dart';
import 'package:manager_app/Components/rounded_input_field.dart';
import 'package:manager_app/constants.dart';
class SliderInputContainer extends StatefulWidget {
final Color color;
final String label;
final double initialValue;
final int min;
final int max;
final ValueChanged<double> onChanged;
const SliderInputContainer({
Key key,
this.color = kSecond,
this.label,
this.initialValue,
this.min,
this.max,
this.onChanged,
}) : super(key: key);
@override
_SliderInputContainerState createState() => _SliderInputContainerState();
}
class _SliderInputContainerState extends State<SliderInputContainer> {
double currentValue;
@override
void initState() {
super.initState();
currentValue = widget.initialValue;
}
@override
Widget build(BuildContext context) {
return Container(
child: Row(
children: [
Align(
alignment: AlignmentDirectional.centerStart,
child: Text(widget.label, style: TextStyle(fontSize: 25, fontWeight: FontWeight.w300))
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Slider(
value: currentValue,
onChanged: (value) {
setState(() => currentValue = value);
widget.onChanged(value);
},
divisions: widget.max - widget.min,
min: widget.min.toDouble(),
max: widget.max.toDouble(),
label: "$currentValue",
activeColor: widget.color,
),
),
],
),
);
}
}

View File

@ -117,7 +117,7 @@ class _ListViewCard extends State<ListViewCard> {
boxDecoration(ImageDTO imageDTO, appContext) {
return BoxDecoration(
color: imageDTO.title == null ? Colors.lightGreen : kBackgroundColor,
color: kBackgroundColor,
shape: BoxShape.rectangle,
border: Border.all(width: 1.5, color: kSecond),
borderRadius: BorderRadius.circular(10.0),

View File

@ -0,0 +1,269 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Components/fetch_section_icon.dart';
import 'package:manager_app/Components/image_input_container.dart';
import 'package:manager_app/Components/multi_select_container.dart';
import 'package:manager_app/Components/slider_input_container.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/showNewOrUpdateGeoPoint.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';
class MapConfig extends StatefulWidget {
final String color;
final String label;
final String initialValue;
final ValueChanged<String> onChanged;
const MapConfig({
Key key,
this.color,
this.label,
this.initialValue,
this.onChanged,
}) : super(key: key);
@override
_MapConfigState createState() => _MapConfigState();
}
class _MapConfigState extends State<MapConfig> {
MapDTO mapDTO;
@override
void initState() {
super.initState();
mapDTO = MapDTO.fromJson(json.decode(widget.initialValue));
List<GeoPointDTO> test = new List<GeoPointDTO>.from(mapDTO.points);
mapDTO.points = test;
}
@override
Widget build(BuildContext context) {
final appContext = Provider.of<AppContext>(context);
Size size = MediaQuery.of(context).size;
return
SingleChildScrollView(
child: Column(
children: [
Container(
height: size.height * 0.15,
width: double.infinity,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
// Icon
ImageInputContainer(
label: "Icône:",
initialValue: mapDTO.iconResourceId,
color: kPrimaryColor,
imageFit: BoxFit.contain,
onChanged: (ResourceDTO resource) {
mapDTO.iconSource = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id;
mapDTO.iconResourceId = resource.id;
widget.onChanged(jsonEncode(mapDTO).toString());
},
),
// Map Type
MultiSelectContainer(
label: "Type :",
initialValue: [mapDTO.mapType.toString()],
isMultiple: false,
values: map_types,
onChanged: (value) {
var tempOutput = new List<String>.from(value);
mapDTO.mapType = MapType.fromJson(tempOutput[0]);
widget.onChanged(jsonEncode(mapDTO).toString());
},
),
// Zoom
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(jsonEncode(mapDTO).toString());
},
)
],
),
),
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: GridView.builder(
shrinkWrap: true,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 8),
itemCount: mapDTO.points.length,
itemBuilder: (BuildContext context, int index) {
return
Container(
decoration: boxDecoration(mapDTO.points[index], appContext),
padding: const EdgeInsets.all(5),
margin: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: getElement(index, mapDTO.points[index], size, appContext),
);
}
),
),
Positioned(
top: 10,
left: 10,
child: Text(
"Points géographiques",
style: TextStyle(fontSize: 15),
),
),
Positioned(
bottom: 10,
right: 10,
child: InkWell(
onTap: () {
showNewOrUpdateGeoPoint(
null,
(GeoPointDTO geoPoint) {
setState(() {
mapDTO.points.add(geoPoint);
widget.onChanged(jsonEncode(mapDTO).toString());
});
},
appContext,
context);
},
child: Container(
height: MediaQuery.of(context).size.width * 0.04,
width: MediaQuery.of(context).size.width * 0.04,
child: Icon(
Icons.add,
color: kTextLightColor,
size: 30.0,
),
decoration: BoxDecoration(
color: Colors.lightGreen,
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, GeoPointDTO point, Size size, AppContext appContext) {
return Container(
width: double.infinity,
height: double.infinity,
child: Stack(
children: [
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: AutoSizeText(
point.title == null ? "" : point.title[0].value,
style: new TextStyle(fontSize: 20),
maxLines: 2,
textAlign: TextAlign.center,
),
),
),
Positioned(
top: 0,
right: 0,
child: Icon(
getSectionIcon(SectionType.map),
color: kSecond,
size: 18.0,
),
),
Positioned(
bottom: 0,
left: 0,
child: InkWell(
onTap: () {
showNewOrUpdateGeoPoint(
mapDTO.points[index],
(GeoPointDTO geoPoint) {
setState(() {
mapDTO.points[index] = geoPoint;
widget.onChanged(jsonEncode(mapDTO).toString());
});
},
appContext,
context);
},
child: Icon(
Icons.edit,
color: kPrimaryColor,
size: 20.0,
)
),
),
Positioned(
bottom: 0,
right: 0,
child: InkWell(
onTap: () {
setState(() {
mapDTO.points.removeAt(index);
});
widget.onChanged(jsonEncode(mapDTO).toString());
},
child: Icon(
Icons.delete,
color: kPrimaryColor,
size: 20.0,
)
),
)
],
),
);
}
}
boxDecoration(GeoPointDTO geoPointDTO, appContext) {
return BoxDecoration(
color: geoPointDTO.title == null ? Colors.lightGreen : 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,194 @@
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/string_input_container.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';
void showNewOrUpdateGeoPoint(GeoPointDTO inputGeoPointDTO, Function getResult, AppContext appContext, BuildContext context) {
GeoPointDTO geoPointDTO = new GeoPointDTO();
print("showNewOrUpdateGeoPoint");
print(inputGeoPointDTO);
if (inputGeoPointDTO != null) {
geoPointDTO = inputGeoPointDTO;
} else {
geoPointDTO.title = <TranslationDTO>[];
geoPointDTO.description = <TranslationDTO>[];
ManagerAppContext managerAppContext = appContext.getContext();
managerAppContext.selectedConfiguration.languages.forEach((element) {
var translationDTO = new TranslationDTO();
translationDTO.language = element;
translationDTO.value = "";
geoPointDTO.title.add(translationDTO);
geoPointDTO.description.add(translationDTO);
});
}
Size size = MediaQuery.of(context).size;
showDialog(
builder: (BuildContext context) => AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(20.0))
),
content: Container(
width: size.width *0.5,
child: SingleChildScrollView(
child: Column(
children: [
Text("Point géographique", style: new TextStyle(fontSize: 25, fontWeight: FontWeight.w400)),
Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ImageInputContainer(
label: "Image :",
initialValue: geoPointDTO.imageResourceId,
color: kPrimaryColor,
onChanged: (ResourceDTO resource) {
geoPointDTO.imageSource = resource.type == ResourceType.imageUrl ? resource.data : appContext.getContext().clientAPI.resourceApi.apiClient.basePath+"/api/Resource/"+ resource.id;
geoPointDTO.imageResourceId = resource.id;
},
),
Column(
children: [
StringInputContainer(
label: "Latitude :",
initialValue: geoPointDTO.latitude,
onChanged: (value) {
geoPointDTO.latitude = value;
},
),
StringInputContainer(
label: "Longitude :",
initialValue: geoPointDTO.longitude,
onChanged: (value) {
geoPointDTO.longitude = value;
},
)
],
)
],
),
Container(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: getTranslations(context, appContext, geoPointDTO),
),
),
),
],
),
],
),
),
),
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.of(context).pop();
},
fontSize: 20,
),
),
),
Align(
alignment: AlignmentDirectional.bottomEnd,
child: Container(
width: geoPointDTO != null ? 220: 150,
height: 70,
child: RoundedButton(
text: geoPointDTO != null ? "Sauvegarder" : "Créer",
icon: Icons.check,
color: kPrimaryColor,
textColor: kWhite,
press: () {
getResult(geoPointDTO);
Navigator.of(context).pop();
},
fontSize: 20,
),
),
),
],
),
],
), context: context
);
}
getTranslations(BuildContext context, AppContext appContext, GeoPointDTO geoPointDTO) {
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: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
TextFormInputContainer(
label: "Titre:",
color: kWhite,
isTitle: true,
initialValue: geoPointDTO.title.where((element) => element.language == language).first.value,
onChanged: (value) {
geoPointDTO.title.where((element) => element.language == language).first.value = value;
},
),
TextFormInputContainer(
label: "Description:",
color: kWhite,
isTitle: false,
initialValue: geoPointDTO.description.where((element) => element.language == language).first.value,
onChanged: (value) {
geoPointDTO.description.where((element) => element.language == language).first.value = value;
},
),
],
),
),
)
],
),
)
);
}
return translations;
}

View File

@ -1,7 +1,3 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:drag_and_drop_lists/drag_and_drop_item.dart';
import 'package:drag_and_drop_lists/drag_and_drop_list.dart';
import 'package:drag_and_drop_lists/drag_and_drop_lists.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:manager_app/Screens/Configurations/Section/SubSection/listViewcard.dart';

View File

@ -17,6 +17,8 @@ import 'package:managerapi/api.dart';
import 'package:provider/provider.dart';
import 'package:intl/intl.dart';
import 'SubSection/map_config.dart';
class SectionDetailScreen extends StatefulWidget {
final String id;
SectionDetailScreen({Key key, @required this.id}) : super(key: key);
@ -67,7 +69,6 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(sectionDTO.label, style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)),
Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
@ -75,7 +76,8 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
color: kPrimaryColor,
size: 25,
),
)
),
Text(sectionDTO.label, style: TextStyle(fontSize: 30, fontWeight: FontWeight.w400)),
],
),
Padding(
@ -110,6 +112,8 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
),
), // TITLE
Container(
/*height: size.height*0.4,
color: Colors.lightBlue,*/
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
@ -132,17 +136,6 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
sectionDTO.label = value;
},
),
MultiSelectContainer(
label: "Type :",
initialValue: [sectionDTO.type.toString()],
isMultiple: false,
values: section_types,
onChanged: (value) {
var tempOutput = new List<String>.from(value);
sectionDTO.type = SectionType.fromJson(tempOutput[0]);
},
),
ImageInputContainer(
label: "Image :",
initialValue: sectionDTO.imageId,
@ -160,6 +153,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
children: [
MultiStringContainer(
label: "Titre :",
modalLabel: "Titre",
color: kPrimaryColor,
initialValue: sectionDTO.title,
onGetResult: (value) {
@ -172,6 +166,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
),
MultiStringContainer(
label: "Description :",
modalLabel: "Description",
color: kPrimaryColor,
initialValue: sectionDTO.description,
onGetResult: (value) {
@ -193,7 +188,7 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
),
),// FIELDS SECTION
Container(
height: size.height * 0.4,
height: size.height * 0.45,
width: size.width * 0.8,
child: Padding(
padding: const EdgeInsets.all(10.0),
@ -298,7 +293,14 @@ class _SectionDetailScreenState extends State<SectionDetailScreen> {
getSpecificData(SectionDTO sectionDTO, AppContext appContext) {
switch(sectionDTO.type) {
case SectionType.map:
return Text("map");
return MapConfig(
initialValue: sectionDTO.data,
onChanged: (String data) {
print("Received info in parent");
print(data);
sectionDTO.data = data;
},
);
case SectionType.slider:
return SliderConfig(
initialValue: sectionDTO.data,

View File

@ -35,23 +35,19 @@ class _ConfigurationsScreenState extends State<ConfigurationsScreen> {
return ConfigurationDetailScreen(id: managerAppContext.selectedConfiguration.id);
} else {
return Container(
child: Column(
children: [
FutureBuilder(
future: getConfigurations(appContext),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<ConfigurationDTO>.from(snapshot.data);
tempOutput.add(ConfigurationDTO(id: null));
return bodyGrid(tempOutput, size, appContext);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
} else {
return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE')));
}
}
),
]
child: FutureBuilder(
future: getConfigurations(appContext),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<ConfigurationDTO>.from(snapshot.data);
tempOutput.add(ConfigurationDTO(id: null));
return bodyGrid(tempOutput, size, appContext);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
} else {
return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE')));
}
}
),
);
}

View File

@ -29,23 +29,19 @@ class _ResourcesScreenState extends State<ResourcesScreen> {
Size size = MediaQuery.of(context).size;
return Container(
child: Column(
children: [
FutureBuilder(
future: getResources(widget.onGetResult, widget.isImage, appContext),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<ResourceDTO>.from(snapshot.data);
tempOutput.add(ResourceDTO(id: null));
return bodyGrid(tempOutput, size, appContext);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
} else {
return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE')));
}
}
),
]
child: FutureBuilder(
future: getResources(widget.onGetResult, widget.isImage, appContext),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
var tempOutput = new List<ResourceDTO>.from(snapshot.data);
tempOutput.add(ResourceDTO(id: null));
return bodyGrid(tempOutput, size, appContext);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
} else {
return Center(child: Container(height: size.height * 0.2, child: Text('LOADING TODO FRAISE')));
}
}
),
);
}

View File

@ -5,7 +5,6 @@ import 'package:flutter/material.dart';
const kTitleTextColor = Color(0xFF303030);
const kBodyTextColor = Color(0xFF4B4B4B); // TODO
const kBackgroundColor = Color(0xFFf5f5f7);
const kPrimaryColor = Color(0xFFCA413F);
const kTextLightColor = Color(0xFFFCFDFD);
@ -14,6 +13,7 @@ const kWhite = Color(0xFFFFFFFF);
const kBlack = Color(0xFF000000);
const List<String> section_types = ["Map", "Slider", "Video", "Web", "Menu"];
const List<String> map_types = ["none", "normal", "satellite", "terrain", "hybrid"];
/*
const kTextStyle = TextStyle(

View File

@ -11,9 +11,8 @@ Name | Type | Description | Notes
**id** | **int** | | [optional]
**title** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**description** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**image** | **String** | | [optional]
**imageType** | **String** | | [optional]
**text** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
**imageResourceId** | **String** | | [optional]
**imageSource** | **String** | | [optional]
**latitude** | **String** | | [optional]
**longitude** | **String** | | [optional]

View File

@ -11,7 +11,8 @@ Name | Type | Description | Notes
**zoom** | **int** | | [optional]
**mapType** | [**MapType**](MapType.md) | | [optional]
**points** | [**List<GeoPointDTO>**](GeoPointDTO.md) | | [optional] [default to const []]
**icon** | **String** | | [optional]
**iconResourceId** | **String** | | [optional]
**iconSource** | **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

@ -15,9 +15,8 @@ class GeoPointDTO {
this.id,
this.title,
this.description,
this.image,
this.imageType,
this.text,
this.imageResourceId,
this.imageSource,
this.latitude,
this.longitude,
});
@ -28,11 +27,9 @@ class GeoPointDTO {
List<TranslationDTO> description;
String image;
String imageResourceId;
String imageType;
List<TranslationDTO> text;
String imageSource;
String latitude;
@ -43,9 +40,8 @@ class GeoPointDTO {
other.id == id &&
other.title == title &&
other.description == description &&
other.image == image &&
other.imageType == imageType &&
other.text == text &&
other.imageResourceId == imageResourceId &&
other.imageSource == imageSource &&
other.latitude == latitude &&
other.longitude == longitude;
@ -54,14 +50,13 @@ class GeoPointDTO {
(id == null ? 0 : id.hashCode) +
(title == null ? 0 : title.hashCode) +
(description == null ? 0 : description.hashCode) +
(image == null ? 0 : image.hashCode) +
(imageType == null ? 0 : imageType.hashCode) +
(text == null ? 0 : text.hashCode) +
(imageResourceId == null ? 0 : imageResourceId.hashCode) +
(imageSource == null ? 0 : imageSource.hashCode) +
(latitude == null ? 0 : latitude.hashCode) +
(longitude == null ? 0 : longitude.hashCode);
@override
String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, image=$image, imageType=$imageType, text=$text, latitude=$latitude, longitude=$longitude]';
String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, imageResourceId=$imageResourceId, imageSource=$imageSource, latitude=$latitude, longitude=$longitude]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -74,14 +69,11 @@ class GeoPointDTO {
if (description != null) {
json[r'description'] = description;
}
if (image != null) {
json[r'image'] = image;
if (imageResourceId != null) {
json[r'imageResourceId'] = imageResourceId;
}
if (imageType != null) {
json[r'imageType'] = imageType;
}
if (text != null) {
json[r'text'] = text;
if (imageSource != null) {
json[r'imageSource'] = imageSource;
}
if (latitude != null) {
json[r'latitude'] = latitude;
@ -100,9 +92,8 @@ class GeoPointDTO {
id: json[r'id'],
title: TranslationDTO.listFromJson(json[r'title']),
description: TranslationDTO.listFromJson(json[r'description']),
image: json[r'image'],
imageType: json[r'imageType'],
text: TranslationDTO.listFromJson(json[r'text']),
imageResourceId: json[r'imageResourceId'],
imageSource: json[r'imageSource'],
latitude: json[r'latitude'],
longitude: json[r'longitude'],
);

View File

@ -15,7 +15,8 @@ class MapDTO {
this.zoom,
this.mapType,
this.points,
this.icon,
this.iconResourceId,
this.iconSource,
});
int zoom;
@ -24,24 +25,28 @@ class MapDTO {
List<GeoPointDTO> points;
String icon;
String iconResourceId;
String iconSource;
@override
bool operator ==(Object other) => identical(this, other) || other is MapDTO &&
other.zoom == zoom &&
other.mapType == mapType &&
other.points == points &&
other.icon == icon;
other.iconResourceId == iconResourceId &&
other.iconSource == iconSource;
@override
int get hashCode =>
(zoom == null ? 0 : zoom.hashCode) +
(mapType == null ? 0 : mapType.hashCode) +
(points == null ? 0 : points.hashCode) +
(icon == null ? 0 : icon.hashCode);
(iconResourceId == null ? 0 : iconResourceId.hashCode) +
(iconSource == null ? 0 : iconSource.hashCode);
@override
String toString() => 'MapDTO[zoom=$zoom, mapType=$mapType, points=$points, icon=$icon]';
String toString() => 'MapDTO[zoom=$zoom, mapType=$mapType, points=$points, iconResourceId=$iconResourceId, iconSource=$iconSource]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -54,8 +59,11 @@ class MapDTO {
if (points != null) {
json[r'points'] = points;
}
if (icon != null) {
json[r'icon'] = icon;
if (iconResourceId != null) {
json[r'iconResourceId'] = iconResourceId;
}
if (iconSource != null) {
json[r'iconSource'] = iconSource;
}
return json;
}
@ -68,7 +76,8 @@ class MapDTO {
zoom: json[r'zoom'],
mapType: MapType.fromJson(json[r'mapType']),
points: GeoPointDTO.listFromJson(json[r'points']),
icon: json[r'icon'],
iconResourceId: json[r'iconResourceId'],
iconSource: json[r'iconSource'],
);
static List<MapDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>

View File

@ -1375,7 +1375,10 @@ components:
nullable: true
items:
$ref: '#/components/schemas/GeoPointDTO'
icon:
iconResourceId:
type: string
nullable: true
iconSource:
type: string
nullable: true
MapType:
@ -1410,17 +1413,12 @@ components:
nullable: true
items:
$ref: '#/components/schemas/TranslationDTO'
image:
imageResourceId:
type: string
nullable: true
imageType:
imageSource:
type: string
nullable: true
text:
type: array
nullable: true
items:
$ref: '#/components/schemas/TranslationDTO'
latitude:
type: string
nullable: true