mirror of
https://bitbucket.org/FransoletThomas/tablet-app.git
synced 2025-12-06 08:31:19 +00:00
update map view + adapt menu view
This commit is contained in:
parent
cba728884f
commit
ef89b623d2
@ -15,7 +15,8 @@ List<Translation> translations = [
|
|||||||
"menu": "Menu",
|
"menu": "Menu",
|
||||||
"quiz.seeResponses": "Voir les réponses",
|
"quiz.seeResponses": "Voir les réponses",
|
||||||
"quiz.restart": "Recommencer",
|
"quiz.restart": "Recommencer",
|
||||||
"map.search": "Rechercher"
|
"map.search": "Rechercher",
|
||||||
|
"back": "Retour"
|
||||||
}),
|
}),
|
||||||
Translation(language: "EN", data: {
|
Translation(language: "EN", data: {
|
||||||
"weather.hourly": "Hourly",
|
"weather.hourly": "Hourly",
|
||||||
@ -31,7 +32,8 @@ List<Translation> translations = [
|
|||||||
"menu": "Menu",
|
"menu": "Menu",
|
||||||
"quiz.seeResponses": "See the answers",
|
"quiz.seeResponses": "See the answers",
|
||||||
"quiz.restart": "Restart",
|
"quiz.restart": "Restart",
|
||||||
"map.search": "Search"
|
"map.search": "Search",
|
||||||
|
"back": "Back"
|
||||||
}),
|
}),
|
||||||
Translation(language: "DE", data: {
|
Translation(language: "DE", data: {
|
||||||
"weather.hourly": "Nächste Stunden",
|
"weather.hourly": "Nächste Stunden",
|
||||||
@ -47,7 +49,8 @@ List<Translation> translations = [
|
|||||||
"menu": "Speisekarte",
|
"menu": "Speisekarte",
|
||||||
"quiz.seeResponses": "Sehen Sie sich die Antworten an",
|
"quiz.seeResponses": "Sehen Sie sich die Antworten an",
|
||||||
"quiz.restart": "Neu starten",
|
"quiz.restart": "Neu starten",
|
||||||
"map.search": "Suchen"
|
"map.search": "Suchen",
|
||||||
|
"back": "Zurück"
|
||||||
}),
|
}),
|
||||||
Translation(language: "NL", data: {
|
Translation(language: "NL", data: {
|
||||||
"weather.hourly": "Volgende uren",
|
"weather.hourly": "Volgende uren",
|
||||||
@ -63,7 +66,8 @@ List<Translation> translations = [
|
|||||||
"menu": "Menu",
|
"menu": "Menu",
|
||||||
"quiz.seeResponses": "Zie de antwoorden",
|
"quiz.seeResponses": "Zie de antwoorden",
|
||||||
"quiz.restart": "Herstarten",
|
"quiz.restart": "Herstarten",
|
||||||
"map.search": "Zoeken"
|
"map.search": "Zoeken",
|
||||||
|
"back": "Rug"
|
||||||
}),
|
}),
|
||||||
Translation(language: "IT", data: {
|
Translation(language: "IT", data: {
|
||||||
"weather.hourly": "Le prossime ore",
|
"weather.hourly": "Le prossime ore",
|
||||||
@ -79,7 +83,8 @@ List<Translation> translations = [
|
|||||||
"menu": "Menù",
|
"menu": "Menù",
|
||||||
"quiz.seeResponses": "Vedi le risposte",
|
"quiz.seeResponses": "Vedi le risposte",
|
||||||
"quiz.restart": "Ricomincia",
|
"quiz.restart": "Ricomincia",
|
||||||
"map.search": "Cerca"
|
"map.search": "Cerca",
|
||||||
|
"back": "Indietro"
|
||||||
}),
|
}),
|
||||||
Translation(language: "ES", data: {
|
Translation(language: "ES", data: {
|
||||||
"weather.hourly": "Próximas horas",
|
"weather.hourly": "Próximas horas",
|
||||||
@ -95,7 +100,8 @@ List<Translation> translations = [
|
|||||||
"menu": "Menú",
|
"menu": "Menú",
|
||||||
"quiz.seeResponses": "Ver las respuestas",
|
"quiz.seeResponses": "Ver las respuestas",
|
||||||
"quiz.restart": "Reanudar",
|
"quiz.restart": "Reanudar",
|
||||||
"map.search": "Buscar"
|
"map.search": "Buscar",
|
||||||
|
"back": "Atrás"
|
||||||
}),
|
}),
|
||||||
Translation(language: "PL", data: {
|
Translation(language: "PL", data: {
|
||||||
"weather.hourly": "Następne godziny",
|
"weather.hourly": "Następne godziny",
|
||||||
@ -111,7 +117,8 @@ List<Translation> translations = [
|
|||||||
"menu": "Menu",
|
"menu": "Menu",
|
||||||
"quiz.seeResponses": "Zobacz odpowiedzi",
|
"quiz.seeResponses": "Zobacz odpowiedzi",
|
||||||
"quiz.restart": "Uruchom ponownie",
|
"quiz.restart": "Uruchom ponownie",
|
||||||
"map.search": "Szukaj"
|
"map.search": "Szukaj",
|
||||||
|
"back": "Z powrotem"
|
||||||
}),
|
}),
|
||||||
Translation(language: "CN", data: {
|
Translation(language: "CN", data: {
|
||||||
"weather.hourly": "接下来的几个小时",
|
"weather.hourly": "接下来的几个小时",
|
||||||
@ -127,7 +134,8 @@ List<Translation> translations = [
|
|||||||
"menu": "菜单",
|
"menu": "菜单",
|
||||||
"quiz.seeResponses": "查看答案",
|
"quiz.seeResponses": "查看答案",
|
||||||
"quiz.restart": "重新开始",
|
"quiz.restart": "重新开始",
|
||||||
"map.search": "搜索"
|
"map.search": "搜索",
|
||||||
|
"back": "后退"
|
||||||
}),
|
}),
|
||||||
Translation(language: "UK", data: {
|
Translation(language: "UK", data: {
|
||||||
"weather.hourly": "Наступні години",
|
"weather.hourly": "Наступні години",
|
||||||
@ -143,7 +151,8 @@ List<Translation> translations = [
|
|||||||
"menu": "Меню",
|
"menu": "Меню",
|
||||||
"quiz.seeResponses": "Подивіться відповіді",
|
"quiz.seeResponses": "Подивіться відповіді",
|
||||||
"quiz.restart": "Перезапустіть",
|
"quiz.restart": "Перезапустіть",
|
||||||
"map.search": "Шукати"
|
"map.search": "Шукати",
|
||||||
|
"back": "Назад"
|
||||||
}),
|
}),
|
||||||
Translation(language: "AR", data: {
|
Translation(language: "AR", data: {
|
||||||
"weather.hourly": "الساعات القادمة",
|
"weather.hourly": "الساعات القادمة",
|
||||||
@ -159,6 +168,7 @@ List<Translation> translations = [
|
|||||||
"menu": "القائمة",
|
"menu": "القائمة",
|
||||||
"quiz.seeResponses": "انظر الإجابات",
|
"quiz.seeResponses": "انظر الإجابات",
|
||||||
"quiz.restart": "إعادة تشغيل",
|
"quiz.restart": "إعادة تشغيل",
|
||||||
"map.search": "بحث"
|
"map.search": "بحث",
|
||||||
|
"back": "خلف"
|
||||||
}),
|
}),
|
||||||
];
|
];
|
||||||
@ -12,14 +12,13 @@ import 'package:flutter/services.dart';
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||||
import 'package:manager_api/api.dart';
|
import 'package:manager_api/api.dart';
|
||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:tablet_app/Components/loading.dart';
|
|
||||||
import 'package:tablet_app/Components/loading_common.dart';
|
import 'package:tablet_app/Components/loading_common.dart';
|
||||||
import 'package:tablet_app/Helpers/DatabaseHelper.dart';
|
import 'package:tablet_app/Helpers/DatabaseHelper.dart';
|
||||||
import 'package:tablet_app/Helpers/ImageCustomProvider.dart';
|
import 'package:tablet_app/Helpers/ImageCustomProvider.dart';
|
||||||
import 'package:tablet_app/Helpers/MQTTHelper.dart';
|
import 'package:tablet_app/Helpers/MQTTHelper.dart';
|
||||||
import 'package:tablet_app/Helpers/translationHelper.dart';
|
import 'package:tablet_app/Helpers/translationHelper.dart';
|
||||||
import 'package:tablet_app/Models/WeatherData.dart';
|
|
||||||
import 'package:tablet_app/Screens/Agenda/agenda_view.dart';
|
import 'package:tablet_app/Screens/Agenda/agenda_view.dart';
|
||||||
import 'package:tablet_app/Screens/Article/article_view.dart';
|
import 'package:tablet_app/Screens/Article/article_view.dart';
|
||||||
import 'package:tablet_app/Screens/Configuration/config_view.dart';
|
import 'package:tablet_app/Screens/Configuration/config_view.dart';
|
||||||
@ -27,7 +26,6 @@ import 'package:tablet_app/Screens/MainView/section_page_detail.dart';
|
|||||||
import 'package:tablet_app/Screens/Weather/weather_view.dart';
|
import 'package:tablet_app/Screens/Weather/weather_view.dart';
|
||||||
import 'package:tablet_app/Screens/Map/map_context.dart';
|
import 'package:tablet_app/Screens/Map/map_context.dart';
|
||||||
import 'package:tablet_app/Screens/Map/map_view.dart';
|
import 'package:tablet_app/Screens/Map/map_view.dart';
|
||||||
import 'package:tablet_app/Models/map-marker.dart';
|
|
||||||
import 'package:tablet_app/Models/tabletContext.dart';
|
import 'package:tablet_app/Models/tabletContext.dart';
|
||||||
import 'package:tablet_app/Screens/Menu/menu_view.dart';
|
import 'package:tablet_app/Screens/Menu/menu_view.dart';
|
||||||
import 'package:tablet_app/Screens/PDF/pdf_view.dart';
|
import 'package:tablet_app/Screens/PDF/pdf_view.dart';
|
||||||
@ -104,381 +102,95 @@ class _MainViewWidget extends State<MainViewWidget> {
|
|||||||
/*if (!MQTTHelper.instance.isInstantiated)
|
/*if (!MQTTHelper.instance.isInstantiated)
|
||||||
MQTTHelper.instance.connect(appContext);*/
|
MQTTHelper.instance.connect(appContext);*/
|
||||||
|
|
||||||
/*if(sectionSelected != null) {
|
return Scaffold(
|
||||||
var elementToShow;
|
|
||||||
print(sectionSelected!.type);
|
|
||||||
switch (sectionSelected!.type) {
|
|
||||||
case SectionType.Map : // MAP
|
|
||||||
elementToShow = ChangeNotifierProvider<MapContext>(
|
|
||||||
create: (_) =>
|
|
||||||
MapContext(new MapMarker(
|
|
||||||
latitude: null,
|
|
||||||
longitude: null,
|
|
||||||
title: '',
|
|
||||||
description: '')),
|
|
||||||
child: FutureBuilder(
|
|
||||||
future: getByteIcon(sectionSelected!),
|
|
||||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
return MapViewWidget(section: sectionSelected!, markerIcon: snapshot.data);
|
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
|
||||||
return Text("No data");
|
|
||||||
} else {
|
|
||||||
return Center(
|
|
||||||
child: Container(
|
|
||||||
child: LoadingCommon()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) /*FutureBuilder(
|
|
||||||
future: _url,
|
|
||||||
builder: (BuildContext context, AsyncSnapshot snapshot) => snapshot.hasData
|
|
||||||
? WebViewWidget(url: snapshot.data,)
|
|
||||||
: CircularProgressIndicator()),*/
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case SectionType.Web : // WEB
|
|
||||||
elementToShow = WebView(section: sectionSelected);
|
|
||||||
break;
|
|
||||||
case SectionType.Video : // Video
|
|
||||||
elementToShow = VideoView(section: sectionSelected);
|
|
||||||
break;
|
|
||||||
case SectionType.Slider :
|
|
||||||
elementToShow = SliderView(section: sectionSelected);
|
|
||||||
break;
|
|
||||||
case SectionType.Menu :
|
|
||||||
elementToShow = MenuView(section: sectionSelected!, isImageBackground: isImageBackground);
|
|
||||||
break;
|
|
||||||
case SectionType.Quizz :
|
|
||||||
elementToShow = QuizzView(section: sectionSelected);
|
|
||||||
break;
|
|
||||||
case SectionType.Pdf :
|
|
||||||
elementToShow = PDFViewWidget(section: sectionSelected);
|
|
||||||
break;
|
|
||||||
case SectionType.Puzzle :
|
|
||||||
elementToShow = PuzzleView(section: sectionSelected);
|
|
||||||
break;
|
|
||||||
case SectionType.Agenda :
|
|
||||||
elementToShow = AgendaView(section: sectionSelected);
|
|
||||||
break;
|
|
||||||
/*case SectionType.article : // TODO
|
|
||||||
elementToShow = ArticleView(section: sectionSelected);
|
|
||||||
break;*/
|
|
||||||
case SectionType.Weather :
|
|
||||||
elementToShow = WeatherView(section: sectionSelected);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
elementToShow = Text("Ce type n'est pas supporté");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return Scaffold(
|
|
||||||
resizeToAvoidBottomInset: false,
|
resizeToAvoidBottomInset: false,
|
||||||
body: SingleChildScrollView(
|
body: Container(
|
||||||
child: Container(
|
height: size.height,
|
||||||
height: size.height,
|
width: size.width,
|
||||||
width: size.width,
|
color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? backgroundColor : kBackgroundGrey : null,
|
||||||
color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? new Color(int.parse(configurationDTO.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null,
|
decoration: configurationDTO.imageId != null ? BoxDecoration(
|
||||||
decoration: configurationDTO.imageId != null ? BoxDecoration(
|
image: new DecorationImage(
|
||||||
image: new DecorationImage(
|
fit: BoxFit.cover,
|
||||||
fit: BoxFit.cover,
|
colorFilter: new ColorFilter.mode(Colors.grey.withOpacity(0.1), BlendMode.color),
|
||||||
colorFilter: new ColorFilter.mode(Colors.white.withOpacity(0.8), BlendMode.lighten),
|
image: ImageCustomProvider.getImageProvider(appContext, configurationDTO.imageId!, configurationDTO.imageSource!)
|
||||||
image: ImageCustomProvider.getImageProvider(appContext, configurationDTO.imageId!, configurationDTO.imageSource!),
|
),
|
||||||
),
|
) : null,
|
||||||
) : null,
|
child: Stack(
|
||||||
child: Padding(
|
children: [
|
||||||
padding: const EdgeInsets.all(8.0),
|
if(currentHourDate.value != null)
|
||||||
child: Container(
|
ValueListenableBuilder<DateTime?>(
|
||||||
decoration : BoxDecoration(
|
valueListenable: currentHourDate,
|
||||||
color: kBackgroundLight,
|
builder: (context, value, _) {
|
||||||
shape: BoxShape.rectangle,
|
return Positioned(
|
||||||
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 30.0),
|
top: 0,
|
||||||
boxShadow: [
|
left: 0,
|
||||||
BoxShadow(
|
|
||||||
color: kBackgroundSecondGrey,
|
|
||||||
spreadRadius: 0.5,
|
|
||||||
blurRadius: 5,
|
|
||||||
offset: Offset(0, 1.5), // changes position of shadow
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 1,
|
|
||||||
//height: size.height * 0.1,
|
|
||||||
child: Container(
|
|
||||||
//color: Colors.greenAccent,
|
|
||||||
width: size.width,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
InkWell(
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) {
|
|
||||||
return Scaffold(
|
|
||||||
body: ChangeNotifierProvider<MapContext>(
|
|
||||||
create: (_) =>
|
|
||||||
MapContext(new MapMarker(
|
|
||||||
latitude: null,
|
|
||||||
longitude: null,
|
|
||||||
title: '',
|
|
||||||
description: '')),
|
|
||||||
child: FutureBuilder(
|
|
||||||
future: getByteIcon(sectionSelected!),
|
|
||||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
return MapViewWidget(section: sectionSelected!, markerIcon: snapshot.data);
|
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
|
||||||
return Text("No data");
|
|
||||||
} else {
|
|
||||||
return Center(
|
|
||||||
child: Container(
|
|
||||||
child: LoadingCommon()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) /*FutureBuilder(
|
|
||||||
future: _url,
|
|
||||||
builder: (BuildContext context, AsyncSnapshot snapshot) => snapshot.hasData
|
|
||||||
? WebViewWidget(url: snapshot.data,)
|
|
||||||
: CircularProgressIndicator()),*/
|
|
||||||
)
|
|
||||||
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),// For pushAndRemoveUntil
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
color: Colors.grey,
|
|
||||||
//width: size.width * 0.8,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 15.0, top: 10.0, bottom: 10.0),
|
|
||||||
child: Container(
|
|
||||||
//color: Colors.grey,
|
|
||||||
child: AspectRatio(
|
|
||||||
aspectRatio: 4 / 4,
|
|
||||||
child: isImageBackground ? Container(
|
|
||||||
/*width: 125,
|
|
||||||
height: 125,*/
|
|
||||||
decoration: boxDecoration(appContext, sectionSelected!, true),
|
|
||||||
) : Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: sectionSelected!.imageSource == null ? kBackgroundLight : null, // default color if no image
|
|
||||||
shape: BoxShape.rectangle,
|
|
||||||
image: sectionSelected!.imageSource != null ? new DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: ImageCustomProvider.getImageProvider(appContext, sectionSelected!.imageId!, sectionSelected!.imageSource!),
|
|
||||||
): null,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
//width: size.width,
|
|
||||||
//color: Colors.green,
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: HtmlWidget(
|
|
||||||
sectionSelected!.title!.firstWhere((translation) => translation.language == appContext.getContext().language).value!,
|
|
||||||
textStyle: new TextStyle(fontSize: kIsWeb ? kWebSectionTitleDetailSize : kSectionTitleDetailSize, color: textColor, fontFamily: 'Roboto'),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
if(sectionSelected!.description!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null && sectionSelected!.description!.firstWhere((translation) => translation.language == appContext.getContext().language).value!.trim().isNotEmpty)
|
|
||||||
Align(
|
|
||||||
//alignment: Alignment.center,
|
|
||||||
child: HtmlWidget(
|
|
||||||
sectionSelected!.description!.firstWhere((translation) => translation.language == appContext.getContext().language).value!,
|
|
||||||
textStyle: new TextStyle(fontSize: kIsWeb? kWebSectionDescriptionDetailSize : kSectionDescriptionDetailSize, color: textColor, fontFamily: 'Roboto'),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(right: 15.0),
|
|
||||||
child: Container(
|
|
||||||
height: size.height *0.08,
|
|
||||||
width: size.width *0.08,
|
|
||||||
child: FittedBox(
|
|
||||||
child: FloatingActionButton.extended(
|
|
||||||
backgroundColor: kBackgroundColor,
|
|
||||||
focusColor: kBackgroundColor,
|
|
||||||
splashColor: kBackgroundColor,
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
sectionSelected = null;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
icon: Icon(Icons.arrow_back, color: Colors.grey),
|
|
||||||
label: Text(TranslationHelper.getFromLocale("menu", appContext.getContext()), style: TextStyle(color: Colors.black))
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
flex: 9,
|
|
||||||
child: Padding(
|
|
||||||
padding: sectionSelected!.type != SectionType.Slider ? const EdgeInsets.only(left: 15.0, right: 15.0, top: 10.0) : const EdgeInsets.only(top: 10.0),
|
|
||||||
child: Container(
|
|
||||||
width: size.width,
|
|
||||||
//height: size.height * 0.9,
|
|
||||||
/*decoration: sectionSelected!.type != SectionType.Video && sectionSelected!.type != SectionType.Web && sectionSelected!.type != SectionType.Slider && sectionSelected!.type != SectionType.Map ? BoxDecoration(
|
|
||||||
//color: kBackgroundLight,
|
|
||||||
shape: BoxShape.rectangle,
|
|
||||||
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 30.0),
|
|
||||||
/*boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: kBackgroundSecondGrey,
|
|
||||||
spreadRadius: 0.5,
|
|
||||||
blurRadius: 5,
|
|
||||||
offset: Offset(0, 1.5), // changes position of shadow
|
|
||||||
),
|
|
||||||
],*/
|
|
||||||
) :null,*/
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: elementToShow),
|
child: Column(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
)
|
children: [
|
||||||
],
|
if(value != null && configurationDTO.isHour!)
|
||||||
),
|
Text(DateFormat('HH:mm').format(value), style: TextStyle(fontSize: 20, color: textColor)),
|
||||||
),
|
if(value != null && configurationDTO.isDate!)
|
||||||
),
|
if(appContext.getContext().language.toString().toUpperCase() == "EN")
|
||||||
),
|
Text(DateFormat('MM/dd').format(value), style: TextStyle(fontSize: 15, color: textColor)),
|
||||||
),
|
if(value != null && configurationDTO.isDate!)
|
||||||
/*floatingActionButtonLocation: FloatingActionButtonLocation.endTop,
|
if(appContext.getContext().language.toString().toUpperCase() != "EN")
|
||||||
floatingActionButton: Padding(
|
Text(DateFormat('dd/MM').format(value), style: TextStyle(fontSize: 15, color: textColor)),
|
||||||
padding: const EdgeInsets.only(top: 10.0),
|
],
|
||||||
child: Container(
|
),
|
||||||
height: size.height *0.08,
|
)
|
||||||
width: size.width *0.08,
|
);
|
||||||
child: FittedBox(
|
},
|
||||||
child: FloatingActionButton.extended(
|
|
||||||
backgroundColor: kBackgroundColor,
|
|
||||||
focusColor: kBackgroundColor,
|
|
||||||
splashColor: kBackgroundColor,
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
sectionSelected = null;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
icon: Icon(Icons.arrow_back, color: Colors.grey),
|
|
||||||
label: Text("Menu", style: TextStyle(color: Colors.black))
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
);
|
|
||||||
} else {*/
|
|
||||||
return Scaffold(
|
|
||||||
resizeToAvoidBottomInset: false,
|
|
||||||
body: Container(
|
|
||||||
height: size.height,
|
|
||||||
width: size.width,
|
|
||||||
color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? backgroundColor : kBackgroundGrey : null,
|
|
||||||
decoration: configurationDTO.imageId != null ? BoxDecoration(
|
|
||||||
image: new DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
colorFilter: new ColorFilter.mode(Colors.grey.withOpacity(0.1), BlendMode.color),
|
|
||||||
image: ImageCustomProvider.getImageProvider(appContext, configurationDTO.imageId!, configurationDTO.imageSource!)
|
|
||||||
),
|
|
||||||
) : null,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
if(currentHourDate.value != null)
|
|
||||||
ValueListenableBuilder<DateTime?>(
|
|
||||||
valueListenable: currentHourDate,
|
|
||||||
builder: (context, value, _) {
|
|
||||||
return Positioned(
|
|
||||||
top: 0,
|
|
||||||
left: 0,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if(value != null && configurationDTO.isHour!)
|
|
||||||
Text(DateFormat('HH:mm').format(value), style: TextStyle(fontSize: 20, color: textColor)),
|
|
||||||
if(value != null && configurationDTO.isDate!)
|
|
||||||
if(appContext.getContext().language.toString().toUpperCase() == "EN")
|
|
||||||
Text(DateFormat('MM/dd').format(value), style: TextStyle(fontSize: 15, color: textColor)),
|
|
||||||
if(value != null && configurationDTO.isDate!)
|
|
||||||
if(appContext.getContext().language.toString().toUpperCase() != "EN")
|
|
||||||
Text(DateFormat('dd/MM').format(value), style: TextStyle(fontSize: 15, color: textColor)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
LanguageSelection(size: size),
|
|
||||||
Center(
|
|
||||||
child: Container(
|
|
||||||
height: configurationDTO.screenPercentageSectionsMainPage != null ? size.height * (configurationDTO.screenPercentageSectionsMainPage! / 100) : size.height * 0.85,
|
|
||||||
width: size.width * 0.9,
|
|
||||||
child: isInit ? FutureBuilder(
|
|
||||||
future: getSections(size, appContext),
|
|
||||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
|
||||||
if (snapshot.data == null) {
|
|
||||||
// Show select config
|
|
||||||
return Text("");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return getGridSections(appContext, textColor);
|
|
||||||
}
|
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
|
||||||
return Text("No data");
|
|
||||||
} else {
|
|
||||||
return Center(
|
|
||||||
child: Container(
|
|
||||||
child: LoadingCommon()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) : getGridSections(appContext, textColor),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
/*if(configurationDTO.weatherCity != null && configurationDTO.weatherCity!.length > 2 && configurationDTO.weatherResult != null)
|
LanguageSelection(size: size),
|
||||||
Positioned(
|
Center(
|
||||||
bottom: 0,
|
child: Container(
|
||||||
left: 0,
|
height: configurationDTO.screenPercentageSectionsMainPage != null ? size.height * (configurationDTO.screenPercentageSectionsMainPage! / 100) : size.height * 0.85,
|
||||||
child: Padding(
|
width: size.width * 0.9,
|
||||||
padding: const EdgeInsets.all(5.0),
|
child: isInit ? FutureBuilder(
|
||||||
child: Builder(
|
future: getSections(size, appContext),
|
||||||
builder: (context) {
|
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||||
Map<String, dynamic> weatherResultInJson = jsonDecode(configurationDTO.weatherResult!);
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
|
if (snapshot.data == null) {
|
||||||
WeatherData weatherDataResult = WeatherData.fromJson(weatherResultInJson);
|
// Show select config
|
||||||
return WeatherView(weatherData: weatherDataResult);
|
return Text("");
|
||||||
}
|
}
|
||||||
),
|
else {
|
||||||
))*/
|
return getGridSections(appContext, textColor);
|
||||||
]),
|
}
|
||||||
),
|
} else if (snapshot.connectionState == ConnectionState.none) {
|
||||||
);
|
return Text("No data");
|
||||||
//}
|
} else {
|
||||||
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
child: LoadingCommon()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) : getGridSections(appContext, textColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
/*if(configurationDTO.weatherCity != null && configurationDTO.weatherCity!.length > 2 && configurationDTO.weatherResult != null)
|
||||||
|
Positioned(
|
||||||
|
bottom: 0,
|
||||||
|
left: 0,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(5.0),
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) {
|
||||||
|
Map<String, dynamic> weatherResultInJson = jsonDecode(configurationDTO.weatherResult!);
|
||||||
|
|
||||||
|
WeatherData weatherDataResult = WeatherData.fromJson(weatherResultInJson);
|
||||||
|
return WeatherView(weatherData: weatherDataResult);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
))*/
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<ConfigurationDTO?> getCurrentConfiguration(dynamic appContext) async {
|
Future<ConfigurationDTO?> getCurrentConfiguration(dynamic appContext) async {
|
||||||
@ -588,12 +300,11 @@ class _MainViewWidget extends State<MainViewWidget> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
//sectionSelected = sectionsLocal![index];
|
//sectionSelected = sectionsLocal![index];
|
||||||
|
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return SectionPageDetail(configurationDTO: configurationDTO, sectionDTO: sectionsLocal![index], textColor: textColor, isImageBackground: isImageBackground, elementToShow: getContent(sectionsLocal![index], isImageBackground));
|
return SectionPageDetail(configurationDTO: configurationDTO, sectionDTO: sectionsLocal![index], textColor: textColor, isImageBackground: isImageBackground, elementToShow: getContent(tabletAppContext, sectionsLocal![index], isImageBackground), isFromMenu: false);
|
||||||
},
|
},
|
||||||
),// For pushAndRemoveUntil
|
),// For pushAndRemoveUntil
|
||||||
);
|
);
|
||||||
@ -691,7 +402,7 @@ boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> getByteIcons(SectionDTO section) async {
|
Future<List<Map<String, dynamic>>> getByteIcons(TabletAppContext tabletAppContext, SectionDTO section) async {
|
||||||
var mapDTO = MapDTO.fromJson(jsonDecode(section.data!));
|
var mapDTO = MapDTO.fromJson(jsonDecode(section.data!));
|
||||||
var selectedMarkerIcon;
|
var selectedMarkerIcon;
|
||||||
|
|
||||||
@ -700,8 +411,14 @@ Future<List<Map<String, dynamic>>> getByteIcons(SectionDTO section) async {
|
|||||||
Uint8List fileData = await http.readBytes(Uri.parse(mapDTO.iconSource!));
|
Uint8List fileData = await http.readBytes(Uri.parse(mapDTO.iconSource!));
|
||||||
selectedMarkerIcon = resizeImage(fileData, 40);
|
selectedMarkerIcon = resizeImage(fileData, 40);
|
||||||
} else {
|
} else {
|
||||||
final ByteData imageData = await NetworkAssetBundle(Uri.parse(mapDTO.iconSource!)).load("");
|
File? localIcon = await _checkIfLocalResourceExists(tabletAppContext, mapDTO.iconResourceId!);
|
||||||
selectedMarkerIcon = await getBytesFromAsset(imageData, 50);
|
if(localIcon == null) {
|
||||||
|
final ByteData imageData = await NetworkAssetBundle(Uri.parse(mapDTO.iconSource!)).load("");
|
||||||
|
selectedMarkerIcon = await getBytesFromAsset(imageData, 50);
|
||||||
|
} else {
|
||||||
|
Uint8List bytes = await localIcon.readAsBytes();
|
||||||
|
selectedMarkerIcon = await getBytesFromAsset(ByteData.view(bytes.buffer), 50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Icône par défaut
|
// Icône par défaut
|
||||||
@ -713,14 +430,21 @@ Future<List<Map<String, dynamic>>> getByteIcons(SectionDTO section) async {
|
|||||||
|
|
||||||
icons.add({'id': null, 'icon': selectedMarkerIcon});
|
icons.add({'id': null, 'icon': selectedMarkerIcon});
|
||||||
|
|
||||||
mapDTO!.categories!.forEach((cat) async {
|
// Utiliser Future.forEach() pour itérer de manière asynchrone sur la liste des catégories
|
||||||
if (cat.iconUrl != null) {
|
await Future.forEach(mapDTO!.categories!, (cat) async {
|
||||||
|
if (cat.iconUrl != null && cat.iconResourceId != null) {
|
||||||
Uint8List categoryIcon;
|
Uint8List categoryIcon;
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
categoryIcon = await http.readBytes(Uri.parse(cat.iconUrl!));
|
categoryIcon = await http.readBytes(Uri.parse(cat.iconUrl!));
|
||||||
} else {
|
} else {
|
||||||
final ByteData imageData = await NetworkAssetBundle(Uri.parse(cat.iconUrl!)).load("");
|
File? localIcon = await _checkIfLocalResourceExists(tabletAppContext, cat.iconResourceId!);
|
||||||
categoryIcon = await getBytesFromAsset(imageData, 50);
|
if(localIcon == null) {
|
||||||
|
final ByteData imageData = await NetworkAssetBundle(Uri.parse(cat.iconUrl!)).load("");
|
||||||
|
categoryIcon = await getBytesFromAsset(imageData, 50);
|
||||||
|
} else {
|
||||||
|
Uint8List bytes = await localIcon.readAsBytes();
|
||||||
|
categoryIcon = await getBytesFromAsset(ByteData.view(bytes.buffer), 50);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
icons.add({'id': cat.id, 'icon': categoryIcon});
|
icons.add({'id': cat.id, 'icon': categoryIcon});
|
||||||
}
|
}
|
||||||
@ -729,14 +453,29 @@ Future<List<Map<String, dynamic>>> getByteIcons(SectionDTO section) async {
|
|||||||
return icons;
|
return icons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<File?> _checkIfLocalResourceExists(TabletAppContext tabletAppContext, String iconId) async {
|
||||||
|
try {
|
||||||
|
Directory? appDocumentsDirectory = Platform.isIOS ? await getApplicationDocumentsDirectory() : await getDownloadsDirectory();
|
||||||
|
String localPath = appDocumentsDirectory!.path;
|
||||||
|
Directory configurationDirectory = Directory('$localPath/${tabletAppContext.configuration!.id}');
|
||||||
|
List<FileSystemEntity> fileList = configurationDirectory.listSync();
|
||||||
|
|
||||||
|
if(fileList.any((fileL) => fileL.uri.pathSegments.last.contains(iconId))) {
|
||||||
|
File file = File(fileList.firstWhere((fileL) => fileL.uri.pathSegments.last.contains(iconId)).path);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
print("ERROR _checkIfLocalResourceExists CachedCustomResource");
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Future<Uint8List> getBytesFromAsset(ByteData data, int width) async {
|
Future<Uint8List> getBytesFromAsset(ByteData data, int width) async {
|
||||||
//ByteData data = await rootBundle.load(path);
|
//ByteData data = await rootBundle.load(path);
|
||||||
ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(),
|
ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), targetWidth: width);
|
||||||
targetWidth: width);
|
|
||||||
ui.FrameInfo fi = await codec.getNextFrame();
|
ui.FrameInfo fi = await codec.getNextFrame();
|
||||||
return (await fi.image.toByteData(format: ui.ImageByteFormat.png))
|
return (await fi.image.toByteData(format: ui.ImageByteFormat.png))!.buffer.asUint8List();
|
||||||
!.buffer
|
|
||||||
.asUint8List();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Uint8List resizeImage(Uint8List data, int width) {
|
Uint8List resizeImage(Uint8List data, int width) {
|
||||||
@ -747,18 +486,14 @@ Uint8List resizeImage(Uint8List data, int width) {
|
|||||||
return resizedData;
|
return resizedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getContent(SectionDTO sectionSelected, bool isImageBackground) {
|
Widget getContent(TabletAppContext tabletAppContext, SectionDTO sectionSelected, bool isImageBackground) {
|
||||||
switch (sectionSelected.type) {
|
switch (sectionSelected.type) {
|
||||||
case SectionType.Map : // MAP
|
case SectionType.Map : // MAP
|
||||||
return ChangeNotifierProvider<MapContext>(
|
return ChangeNotifierProvider<MapContext>(
|
||||||
create: (_) =>
|
create: (_) =>
|
||||||
MapContext(new MapMarker(
|
MapContext(null),
|
||||||
latitude: null,
|
|
||||||
longitude: null,
|
|
||||||
title: '',
|
|
||||||
description: '')),
|
|
||||||
child: FutureBuilder(
|
child: FutureBuilder(
|
||||||
future: getByteIcons(sectionSelected),
|
future: getByteIcons(tabletAppContext, sectionSelected),
|
||||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
if (snapshot.connectionState == ConnectionState.done) {
|
||||||
return MapViewWidget(section: sectionSelected, icons: snapshot.data);
|
return MapViewWidget(section: sectionSelected, icons: snapshot.data);
|
||||||
@ -785,7 +520,7 @@ Widget getContent(SectionDTO sectionSelected, bool isImageBackground) {
|
|||||||
case SectionType.Slider :
|
case SectionType.Slider :
|
||||||
return SliderView(section: sectionSelected);
|
return SliderView(section: sectionSelected);
|
||||||
case SectionType.Menu :
|
case SectionType.Menu :
|
||||||
return MenuView(section: sectionSelected!, isImageBackground: isImageBackground);
|
return MenuView(section: sectionSelected, isImageBackground: isImageBackground);
|
||||||
case SectionType.Quizz :
|
case SectionType.Quizz :
|
||||||
return QuizzView(section: sectionSelected);
|
return QuizzView(section: sectionSelected);
|
||||||
case SectionType.Pdf :
|
case SectionType.Pdf :
|
||||||
@ -802,6 +537,4 @@ Widget getContent(SectionDTO sectionSelected, bool isImageBackground) {
|
|||||||
default:
|
default:
|
||||||
return Text("Ce type n'est pas supporté");
|
return Text("Ce type n'est pas supporté");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -13,6 +13,7 @@ import 'package:tablet_app/Helpers/ImageCustomProvider.dart';
|
|||||||
import 'package:tablet_app/Helpers/translationHelper.dart';
|
import 'package:tablet_app/Helpers/translationHelper.dart';
|
||||||
import 'package:tablet_app/Models/map-marker.dart';
|
import 'package:tablet_app/Models/map-marker.dart';
|
||||||
import 'package:tablet_app/Models/tabletContext.dart';
|
import 'package:tablet_app/Models/tabletContext.dart';
|
||||||
|
import 'package:tablet_app/Screens/MainView/main_view.dart';
|
||||||
import 'package:tablet_app/Screens/Map/geo_point_filter.dart';
|
import 'package:tablet_app/Screens/Map/geo_point_filter.dart';
|
||||||
import 'package:tablet_app/Screens/Map/map_context.dart';
|
import 'package:tablet_app/Screens/Map/map_context.dart';
|
||||||
import 'package:html/parser.dart' show parse;
|
import 'package:html/parser.dart' show parse;
|
||||||
@ -25,6 +26,7 @@ class SectionPageDetail extends StatefulWidget {
|
|||||||
final Uint8List? selectedMarkerIcon;
|
final Uint8List? selectedMarkerIcon;
|
||||||
final Color textColor;
|
final Color textColor;
|
||||||
final bool isImageBackground;
|
final bool isImageBackground;
|
||||||
|
final bool isFromMenu;
|
||||||
final Widget elementToShow;
|
final Widget elementToShow;
|
||||||
const SectionPageDetail({
|
const SectionPageDetail({
|
||||||
Key? key,
|
Key? key,
|
||||||
@ -33,6 +35,7 @@ class SectionPageDetail extends StatefulWidget {
|
|||||||
this.selectedMarkerIcon,
|
this.selectedMarkerIcon,
|
||||||
required this.textColor,
|
required this.textColor,
|
||||||
required this.isImageBackground,
|
required this.isImageBackground,
|
||||||
|
required this.isFromMenu,
|
||||||
required this.elementToShow,
|
required this.elementToShow,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@ -155,9 +158,21 @@ class _SectionPageDetailState extends State<SectionPageDetail> {
|
|||||||
splashColor: kBackgroundColor,
|
splashColor: kBackgroundColor,
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
/*Navigator.of(context).pushReplacement(
|
||||||
|
PageRouteBuilder(
|
||||||
|
transitionDuration: Duration(milliseconds: 500), // Durée de la transition en millisecondes
|
||||||
|
pageBuilder: (_, __, ___) => MainViewWidget(), // Page précédente
|
||||||
|
transitionsBuilder: (_, animation, __, child) {
|
||||||
|
return FadeTransition(
|
||||||
|
opacity: animation,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);*/
|
||||||
},
|
},
|
||||||
icon: Icon(Icons.arrow_back, color: Colors.grey),
|
icon: Icon(Icons.arrow_back, color: Colors.grey),
|
||||||
label: Text(TranslationHelper.getFromLocale("menu", appContext.getContext()), style: TextStyle(color: Colors.black))
|
label: Text(TranslationHelper.getFromLocale(widget.isFromMenu ? "back" : "menu", appContext.getContext()), style: TextStyle(color: Colors.black))
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -66,6 +66,21 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
|
|||||||
List<TreeNode> buildTreeNodes(List<CategorieDTO> categories, List<GeoPointDTO> geoPoints) {
|
List<TreeNode> buildTreeNodes(List<CategorieDTO> categories, List<GeoPointDTO> geoPoints) {
|
||||||
List<TreeNode> nodes = [];
|
List<TreeNode> nodes = [];
|
||||||
|
|
||||||
|
// Pour chaque point sans categorie, créer un noeud
|
||||||
|
for(var pointWithoutCat in geoPoints.where((gp) => gp.categorieId == null && gp.categorie == null))
|
||||||
|
{
|
||||||
|
TreeNode nodeWithoutCat = TreeNode(
|
||||||
|
id: int.parse(pointWithoutCat.latitude!.substring(0,10).replaceAll(".", "")+pointWithoutCat.longitude!.substring(0,10).replaceAll(".", "")),
|
||||||
|
title: parse(pointWithoutCat.title!.firstWhere((l) => l.language == widget.language).value!).documentElement!.text,
|
||||||
|
children: [],
|
||||||
|
checked: true, // default true
|
||||||
|
show: false,
|
||||||
|
pid: 0,
|
||||||
|
commonID: 0,
|
||||||
|
);
|
||||||
|
nodes.add(nodeWithoutCat);
|
||||||
|
}
|
||||||
|
|
||||||
// Pour chaque catégorie, créez un nœud parent
|
// Pour chaque catégorie, créez un nœud parent
|
||||||
for (var category in categories) {
|
for (var category in categories) {
|
||||||
TreeNode categoryNode = TreeNode(
|
TreeNode categoryNode = TreeNode(
|
||||||
@ -79,7 +94,7 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Ajoutez les géopoints correspondant à cette catégorie en tant qu'enfants du nœud parent
|
// Ajoutez les géopoints correspondant à cette catégorie en tant qu'enfants du nœud parent
|
||||||
for (var geoPoint in geoPoints) {
|
for (var geoPoint in geoPoints.where((gp) => gp.categorie != null || gp.categorieId != null)) {
|
||||||
if (geoPoint.categorieId == category.id) {
|
if (geoPoint.categorieId == category.id) {
|
||||||
TreeNode geoPointNode = TreeNode(
|
TreeNode geoPointNode = TreeNode(
|
||||||
id: int.parse(geoPoint.latitude!.substring(0,10).replaceAll(".", "")+geoPoint.longitude!.substring(0,10).replaceAll(".", "")),
|
id: int.parse(geoPoint.latitude!.substring(0,10).replaceAll(".", "")+geoPoint.longitude!.substring(0,10).replaceAll(".", "")),
|
||||||
@ -97,6 +112,8 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
|
|||||||
nodes.add(categoryNode);
|
nodes.add(categoryNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodes.sort((a, b) => a.title.compareTo(b.title));
|
||||||
|
|
||||||
return nodes;
|
return nodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,6 +142,10 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
|
|||||||
checkedGeoPoints.add(widget.geoPoints.firstWhere((point) => int.parse(point.latitude!.substring(0,10).replaceAll(".", "")+point.longitude!.substring(0,10).replaceAll(".", "")) == childNode.id));
|
checkedGeoPoints.add(widget.geoPoints.firstWhere((point) => int.parse(point.latitude!.substring(0,10).replaceAll(".", "")+point.longitude!.substring(0,10).replaceAll(".", "")) == childNode.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(node.checked) {
|
||||||
|
checkedGeoPoints.add(widget.geoPoints.firstWhere((point) => int.parse(point.latitude!.substring(0,10).replaceAll(".", "")+point.longitude!.substring(0,10).replaceAll(".", "")) == node.id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +216,7 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
|
|||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: TranslationHelper.getFromLocale("map.search", appContext.getContext()),
|
labelText: TranslationHelper.getFromLocale("map.search", appContext.getContext()),
|
||||||
labelStyle: TextStyle(
|
labelStyle: TextStyle(
|
||||||
color: focusNode.hasFocus ? primaryColor : Colors.black
|
color: Colors.black
|
||||||
),
|
),
|
||||||
focusColor: primaryColor,
|
focusColor: primaryColor,
|
||||||
focusedBorder: OutlineInputBorder(
|
focusedBorder: OutlineInputBorder(
|
||||||
@ -203,7 +224,7 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
|
|||||||
borderSide: BorderSide(color: primaryColor)),
|
borderSide: BorderSide(color: primaryColor)),
|
||||||
//labelStyle: TextStyle(color: primaryColor),
|
//labelStyle: TextStyle(color: primaryColor),
|
||||||
suffixIcon: IconButton(
|
suffixIcon: IconButton(
|
||||||
icon: _searchController.text.isNotEmpty ? Icon(Icons.close) : Icon(Icons.search),
|
icon: _searchController.text.isNotEmpty ? Icon(Icons.close, color: primaryColor) : Icon(Icons.search, color: primaryColor),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if(_searchController.text.isNotEmpty) {
|
if(_searchController.text.isNotEmpty) {
|
||||||
_searchController.text = "";
|
_searchController.text = "";
|
||||||
@ -226,8 +247,8 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: _toggleExpansion,
|
onTap: _toggleExpansion,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(top: 4.0, right: 3.0),
|
padding: const EdgeInsets.only(top: 1.5, right: 1.1),
|
||||||
child: Icon(_isExpanded ? Icons.expand_more : Icons.chevron_right, color: primaryColor),
|
child: Icon(_isExpanded ? Icons.expand_more : Icons.chevron_left, color: primaryColor),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -237,29 +258,24 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
|
|||||||
ValueListenableBuilder<String>(
|
ValueListenableBuilder<String>(
|
||||||
valueListenable: _searchTextNotifier,
|
valueListenable: _searchTextNotifier,
|
||||||
builder: (context, value, _) {
|
builder: (context, value, _) {
|
||||||
return Container(
|
return Stack(
|
||||||
//color: Colors.greenAccent,
|
children: [
|
||||||
height: _isExpanded ? widget.provider == MapProvider.Google ? size.height * 0.68 : size.height * 0.65 : 0,
|
Container(
|
||||||
width: size.width * 0.3,
|
//color: Colors.greenAccent,
|
||||||
child: GenerateTree(
|
height: _isExpanded ? widget.provider == MapProvider.Google ? size.height * 0.68 : size.height * 0.65 : 0,
|
||||||
data: _filteredNodes,
|
width: size.width * 0.3,
|
||||||
selectOneToAll: true,
|
child: GenerateTree(
|
||||||
textColor: Colors.black,
|
data: _filteredNodes,
|
||||||
onChecked: (node, checked, commonID) {
|
selectOneToAll: true,
|
||||||
if(checked) {
|
textColor: Colors.black,
|
||||||
//node.
|
onChecked: (node, checked, commonID) {
|
||||||
//var test =
|
sendFilteredGeoPoint();
|
||||||
//selectedGeoPoints.add();
|
},
|
||||||
}
|
checkBoxColor: primaryColor,
|
||||||
print('isChecked : $checked');
|
childrenPadding: EdgeInsets.only(left: 20, top: 10, right: 0, bottom: 10),
|
||||||
print('common Node ID : ${commonID}');
|
),
|
||||||
print('children node data : ${node.children.map((e) => '${e.title}')}');
|
),
|
||||||
// Todo update selection
|
],
|
||||||
sendFilteredGeoPoint();
|
|
||||||
},
|
|
||||||
checkBoxColor: primaryColor,
|
|
||||||
childrenPadding: EdgeInsets.only(left: 20, top: 10, right: 0, bottom: 10),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|||||||
@ -17,11 +17,13 @@ import 'package:tablet_app/constants.dart';
|
|||||||
|
|
||||||
class GoogleMapView extends StatefulWidget {
|
class GoogleMapView extends StatefulWidget {
|
||||||
final MapDTO mapDTO;
|
final MapDTO mapDTO;
|
||||||
|
final List<GeoPointDTO> geoPoints;
|
||||||
final List<Map<String, dynamic>> icons;
|
final List<Map<String, dynamic>> icons;
|
||||||
final String? language;
|
final String? language;
|
||||||
const GoogleMapView({
|
const GoogleMapView({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.mapDTO,
|
required this.mapDTO,
|
||||||
|
required this.geoPoints,
|
||||||
required this.icons,
|
required this.icons,
|
||||||
this.language,
|
this.language,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
@ -35,58 +37,53 @@ class _GoogleMapViewState extends State<GoogleMapView> {
|
|||||||
Completer<GoogleMapController> _controller = Completer();
|
Completer<GoogleMapController> _controller = Completer();
|
||||||
Set<Marker> markers = {};
|
Set<Marker> markers = {};
|
||||||
List<GeoPointDTO>? pointsToShow = [];
|
List<GeoPointDTO>? pointsToShow = [];
|
||||||
List<String>? selectedCategories = [];
|
//List<String>? selectedCategories = [];
|
||||||
bool init = false;
|
bool init = false;
|
||||||
|
|
||||||
Set<Marker> getMarkers(language, mapContext) {
|
Set<Marker> getMarkers(language, mapContext) {
|
||||||
markers = {};
|
markers = {};
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
pointsToShow!.forEach((point) {
|
pointsToShow!.forEach((point) {
|
||||||
var textSansHTML = parse(point.title!.firstWhere((translation) => translation.language == language).value);
|
var textSansHTML = parse(point.title!.firstWhere((translation) => translation.language == language).value);
|
||||||
var mapMarker = new MapMarker(
|
point.id = i;
|
||||||
|
/*var mapMarker = new MapMarker(
|
||||||
id: point.id,
|
id: point.id,
|
||||||
title: parse(textSansHTML.body!.text).documentElement!.text,
|
title: parse(textSansHTML.body!.text).documentElement!.text,
|
||||||
description: point.description!.firstWhere((translation) => translation.language == language).value,
|
description: point.description!.firstWhere((translation) => translation.language == language).value,
|
||||||
longitude: point.longitude,
|
longitude: point.longitude,
|
||||||
latitude: point.latitude,
|
latitude: point.latitude,
|
||||||
contents: point.contents
|
contents: point.contents
|
||||||
);
|
);*/
|
||||||
if (mapMarker.latitude != null && mapMarker.longitude != null) {
|
if (point.latitude != null && point.longitude != null) {
|
||||||
|
var icon = point.categorie == null ? BitmapDescriptor.fromBytes(widget.icons.where((i) => i['id'] == null).first['icon']) : widget.icons.any((i) => i['id'] == point.categorieId) ? BitmapDescriptor.fromBytes(widget.icons.where((i) => i['id'] == point.categorieId).first['icon']) : BitmapDescriptor.fromBytes(widget.icons.where((i) => i['id'] == null).first['icon']); //widget.selectedMarkerIcon,;
|
||||||
markers.add(Marker(
|
markers.add(Marker(
|
||||||
draggable: false,
|
draggable: false,
|
||||||
markerId: MarkerId(parse(textSansHTML.body!.text).documentElement!.text + mapMarker.latitude! + mapMarker.longitude!),
|
markerId: MarkerId(parse(textSansHTML.body!.text).documentElement!.text + point.latitude! + point.longitude!),
|
||||||
position: LatLng(
|
position: LatLng(
|
||||||
double.tryParse(mapMarker.latitude!)!,
|
double.tryParse(point.latitude!)!,
|
||||||
double.tryParse(mapMarker.longitude!)!,
|
double.tryParse(point.longitude!)!,
|
||||||
),
|
),
|
||||||
icon: point.categorie == null ? BitmapDescriptor.fromBytes(widget.icons.where((i) => i['id'] == null).first['icon']) : widget.icons.any((i) => i['id'] == point.categorieId) ? BitmapDescriptor.fromBytes(widget.icons.where((i) => i['id'] == point.categorieId).first['icon']) : BitmapDescriptor.fromBytes(widget.icons.where((i) => i['id'] == null).first['icon']), //widget.selectedMarkerIcon,
|
icon: icon, //widget.selectedMarkerIcon,
|
||||||
//widget.selectedMarkerIcon != null ? BitmapDescriptor.fromBytes(widget.selectedMarkerIcon!) : BitmapDescriptor.defaultMarker,
|
//widget.selectedMarkerIcon != null ? BitmapDescriptor.fromBytes(widget.selectedMarkerIcon!) : BitmapDescriptor.defaultMarker,
|
||||||
/*icon: BitmapDescriptor.defaultMarkerWithHue(
|
/*icon: BitmapDescriptor.defaultMarkerWithHue(
|
||||||
BitmapDescriptor.hueYellow,
|
BitmapDescriptor.hueYellow,
|
||||||
),*/
|
),*/
|
||||||
onTap: () {
|
onTap: () {
|
||||||
//setState(() {
|
//setState(() {
|
||||||
mapContext.setSelectedMarker(
|
mapContext.setSelectedPoint(point);
|
||||||
new MapMarker(
|
|
||||||
title: mapMarker.title,
|
|
||||||
contents: mapMarker.contents,
|
|
||||||
description: mapMarker.description,
|
|
||||||
longitude: mapMarker.longitude,
|
|
||||||
latitude: mapMarker.latitude,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
//});
|
//});
|
||||||
},
|
},
|
||||||
infoWindow: InfoWindow.noText));
|
infoWindow: InfoWindow.noText));
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
});
|
});
|
||||||
return markers;
|
return markers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
pointsToShow = widget.mapDTO!.points;
|
//selectedCategories = widget.mapDTO.categories!.map((cat) => cat.label!.firstWhere((element) => element.language == widget.language).value!).toList();
|
||||||
selectedCategories = widget.mapDTO!.categories!.map((categorie) => categorie.label!.firstWhere((element) => element.language == widget.language).value!).toList();
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,18 +100,20 @@ class _GoogleMapViewState extends State<GoogleMapView> {
|
|||||||
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
|
|
||||||
if(!init) {
|
pointsToShow = widget.geoPoints;
|
||||||
print("getmarkers in build");
|
|
||||||
|
/*if(!init) {
|
||||||
|
print("getmarkers in build");*/
|
||||||
getMarkers(widget.language, mapContext);
|
getMarkers(widget.language, mapContext);
|
||||||
init = true;
|
/* init = true;
|
||||||
}
|
}*/
|
||||||
//MapTypeApp? mapTypeApp = MapTypeApp.fromJson(widget.mapDTO!.mapType!.value);
|
//MapTypeApp? mapTypeApp = MapTypeApp.fromJson(widget.mapDTO!.mapType!.value);
|
||||||
//print(mapTypeApp.toString());
|
//print(mapTypeApp.toString());
|
||||||
|
|
||||||
MapType type = MapType.hybrid;
|
MapType type = MapType.hybrid;
|
||||||
//if(kIsWeb) {
|
//if(kIsWeb) {
|
||||||
if(widget.mapDTO!.mapType != null) {
|
if(widget.mapDTO.mapType != null) {
|
||||||
switch(widget.mapDTO!.mapType!.value) {
|
switch(widget.mapDTO.mapType!.value) {
|
||||||
case 0:
|
case 0:
|
||||||
type = MapType.none;
|
type = MapType.none;
|
||||||
break;
|
break;
|
||||||
@ -148,8 +147,8 @@ class _GoogleMapViewState extends State<GoogleMapView> {
|
|||||||
mapToolbarEnabled: false,
|
mapToolbarEnabled: false,
|
||||||
indoorViewEnabled: false,
|
indoorViewEnabled: false,
|
||||||
initialCameraPosition: CameraPosition(
|
initialCameraPosition: CameraPosition(
|
||||||
target: LatLng(50.465503, 4.865105), //TODO add element in manager // MDLF 50.416639, 4.879169 / Namur 50.465503, 4.865105
|
target: widget.mapDTO.longitude != null && widget.mapDTO.latitude != null ? LatLng(double.tryParse(widget.mapDTO.latitude!)!, double.tryParse(widget.mapDTO.longitude!)!) : LatLng(50.465503, 4.865105) , // MDLF 50.416639, 4.879169 / Namur 50.465503, 4.865105
|
||||||
zoom: widget.mapDTO!.zoom != null ? widget.mapDTO!.zoom!.toDouble() : 18,
|
zoom: widget.mapDTO.zoom != null ? widget.mapDTO.zoom!.toDouble() : 18,
|
||||||
),
|
),
|
||||||
onMapCreated: (GoogleMapController controller) {
|
onMapCreated: (GoogleMapController controller) {
|
||||||
if(kIsWeb) {
|
if(kIsWeb) {
|
||||||
@ -162,14 +161,7 @@ class _GoogleMapViewState extends State<GoogleMapView> {
|
|||||||
onTap: (LatLng location) {
|
onTap: (LatLng location) {
|
||||||
//setState(() {
|
//setState(() {
|
||||||
print(location);
|
print(location);
|
||||||
mapContext.setSelectedMarker(
|
mapContext.setSelectedPoint(null);
|
||||||
new MapMarker(
|
|
||||||
title: '',
|
|
||||||
description: '',
|
|
||||||
contents: null,
|
|
||||||
longitude: null,
|
|
||||||
latitude: null
|
|
||||||
));
|
|
||||||
// });
|
// });
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class MapBoxView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class AnnotationClickListener extends mapBox.OnPointAnnotationClickListener {
|
class AnnotationClickListener extends mapBox.OnPointAnnotationClickListener {
|
||||||
late List<MapMarker> markersList;
|
late List<GeoPointDTO> markersList;
|
||||||
late MapContext mapContext;
|
late MapContext mapContext;
|
||||||
|
|
||||||
AnnotationClickListener({
|
AnnotationClickListener({
|
||||||
@ -46,8 +46,8 @@ class AnnotationClickListener extends mapBox.OnPointAnnotationClickListener {
|
|||||||
@override
|
@override
|
||||||
void onPointAnnotationClick(mapBox.PointAnnotation annotation) {
|
void onPointAnnotationClick(mapBox.PointAnnotation annotation) {
|
||||||
try{
|
try{
|
||||||
var markerToShow = markersList.firstWhere((ml) => "${ml.title}${ml.latitude}${ml.longitude}" == annotation.textField);
|
var markerToShow = markersList.firstWhere((ml) => "${parse(ml.title!.first.value).documentElement!.text}${ml.latitude}${ml.longitude}" == annotation.textField);
|
||||||
mapContext.setSelectedMarker(markerToShow);
|
mapContext.setSelectedPoint(markerToShow);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
print("ISSSUE setSelectedMarker");
|
print("ISSSUE setSelectedMarker");
|
||||||
print(e);
|
print(e);
|
||||||
@ -63,25 +63,28 @@ class _MapBoxViewState extends State<MapBoxView> {
|
|||||||
createPoints() {
|
createPoints() {
|
||||||
var options = <mapBox.PointAnnotationOptions>[];
|
var options = <mapBox.PointAnnotationOptions>[];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
markersList = [];
|
||||||
pointsToShow!.forEach((point) {
|
pointsToShow!.forEach((point) {
|
||||||
var textSansHTML = parse(point.title!.firstWhere((translation) => translation.language == widget.language).value);
|
var textSansHTML = parse(point.title!.firstWhere((translation) => translation.language == widget.language).value);
|
||||||
var mapMarker = new MapMarker(
|
point.id = i;
|
||||||
|
point.title = point.title!.where((t) => t.language == widget.language).toList();
|
||||||
|
/*var mapMarker = new MapMarker(
|
||||||
id: i,
|
id: i,
|
||||||
title: parse(textSansHTML.body!.text).documentElement!.text,
|
title: parse(textSansHTML.body!.text).documentElement!.text,
|
||||||
description: point.description!.firstWhere((translation) => translation.language == widget.language).value,
|
description: point.description!.firstWhere((translation) => translation.language == widget.language).value,
|
||||||
longitude: point.longitude,
|
longitude: point.longitude,
|
||||||
latitude: point.latitude,
|
latitude: point.latitude,
|
||||||
contents: point.contents
|
contents: point.contents
|
||||||
);
|
);*/
|
||||||
markersList.add(mapMarker);
|
markersList.add(point);
|
||||||
options.add(mapBox.PointAnnotationOptions(
|
options.add(mapBox.PointAnnotationOptions(
|
||||||
geometry: mapBox.Point(
|
geometry: mapBox.Point(
|
||||||
coordinates: mapBox.Position(
|
coordinates: mapBox.Position(
|
||||||
double.tryParse(mapMarker.longitude!)!,
|
double.tryParse(point.longitude!)!,
|
||||||
double.tryParse(mapMarker.latitude!)!,
|
double.tryParse(point.latitude!)!,
|
||||||
)).toJson(),
|
)).toJson(),
|
||||||
iconSize: 1.3,
|
iconSize: 1.3,
|
||||||
textField: "${parse(textSansHTML.body!.text).documentElement!.text}${mapMarker.latitude}${mapMarker.longitude}",
|
textField: "${parse(textSansHTML.body!.text).documentElement!.text}${point.latitude}${point.longitude}",
|
||||||
textOpacity: 0.0,
|
textOpacity: 0.0,
|
||||||
iconOffset: [0.0, 0.0],
|
iconOffset: [0.0, 0.0],
|
||||||
symbolSortKey: 10,
|
symbolSortKey: 10,
|
||||||
@ -181,10 +184,10 @@ class _MapBoxViewState extends State<MapBoxView> {
|
|||||||
},
|
},
|
||||||
onTapListener: (listener) {
|
onTapListener: (listener) {
|
||||||
// close on tap
|
// close on tap
|
||||||
mapContext.setSelectedMarker(new MapMarker(longitude: null, latitude: null, title: '', contents: null, description: ''));
|
mapContext.setSelectedPoint(null);
|
||||||
},
|
},
|
||||||
cameraOptions: mapBox.CameraOptions(
|
cameraOptions: mapBox.CameraOptions(
|
||||||
center: mapBox.Point(coordinates: mapBox.Position(4.865105, 50.465503)).toJson(), //TODO add element in manager // MDLF 50.416639, 4.879169 / Namur 50.465503, 4.865105
|
center: mapBox.Point(coordinates: widget.mapDTO!.longitude != null && widget.mapDTO!.latitude != null ? mapBox.Position(double.tryParse(widget.mapDTO!.longitude!)!, double.tryParse(widget.mapDTO!.latitude!)!) : mapBox.Position(4.865105, 50.465503)).toJson(),//TODO add element in manager // MDLF 50.416639, 4.879169 / Namur 50.465503, 4.865105
|
||||||
zoom: widget.mapDTO!.zoom != null ? widget.mapDTO!.zoom!.toDouble() : 12),
|
zoom: widget.mapDTO!.zoom != null ? widget.mapDTO!.zoom!.toDouble() : 12),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:tablet_app/Models/map-marker.dart';
|
import 'package:manager_api/api.dart';
|
||||||
|
|
||||||
class MapContext with ChangeNotifier {
|
class MapContext with ChangeNotifier {
|
||||||
MapMarker _selectedMarker;
|
GeoPointDTO? _selectedPoint;
|
||||||
|
|
||||||
MapContext(this._selectedMarker);
|
MapContext(this._selectedPoint);
|
||||||
|
|
||||||
getSelectedMarker() => _selectedMarker;
|
getSelectedPoint() => _selectedPoint;
|
||||||
setSelectedMarker(MapMarker selectedMarker) {
|
setSelectedPoint(GeoPointDTO? selectedPoint) {
|
||||||
_selectedMarker = selectedMarker;
|
_selectedPoint = selectedPoint;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import 'google_map_view.dart';
|
|||||||
//import 'package:image/image.dart' as IMG;
|
//import 'package:image/image.dart' as IMG;
|
||||||
|
|
||||||
//Set<Marker> markers = {};
|
//Set<Marker> markers = {};
|
||||||
List<MapMarker> markersList = [];
|
List<GeoPointDTO> markersList = [];
|
||||||
|
|
||||||
class MapViewWidget extends StatefulWidget {
|
class MapViewWidget extends StatefulWidget {
|
||||||
final SectionDTO section;
|
final SectionDTO section;
|
||||||
@ -96,12 +96,12 @@ class _MapViewWidget extends State<MapViewWidget> {
|
|||||||
builder: (context, value, _) {
|
builder: (context, value, _) {
|
||||||
switch(mapDTO!.mapProvider) {
|
switch(mapDTO!.mapProvider) {
|
||||||
case MapProvider.Google:
|
case MapProvider.Google:
|
||||||
return GoogleMapView(language: appContext.getContext().language, mapDTO: mapDTO!, icons: widget.icons);
|
return GoogleMapView(language: appContext.getContext().language, geoPoints: value, mapDTO: mapDTO!, icons: widget.icons);
|
||||||
case MapProvider.MapBox:
|
case MapProvider.MapBox:
|
||||||
return MapBoxView(language: appContext.getContext().language, geoPoints: value, mapDTO: mapDTO, icons: widget.icons);
|
return MapBoxView(language: appContext.getContext().language, geoPoints: value, mapDTO: mapDTO, icons: widget.icons);
|
||||||
default:
|
default:
|
||||||
// By default google
|
// By default google
|
||||||
return GoogleMapView(language: appContext.getContext().language, mapDTO: mapDTO!, icons: widget.icons);
|
return GoogleMapView(language: appContext.getContext().language, geoPoints: value, mapDTO: mapDTO!, icons: widget.icons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@ -109,7 +109,7 @@ class _MapViewWidget extends State<MapViewWidget> {
|
|||||||
language: tabletAppContext.language!,
|
language: tabletAppContext.language!,
|
||||||
geoPoints: mapDTO!.points!,
|
geoPoints: mapDTO!.points!,
|
||||||
categories: mapDTO!.categories!,
|
categories: mapDTO!.categories!,
|
||||||
provider: mapDTO!.mapProvider!,
|
provider: mapDTO!.mapProvider == null ? MapProvider.Google : mapDTO!.mapProvider!,
|
||||||
filteredPoints: (value) {
|
filteredPoints: (value) {
|
||||||
_geoPoints.value = value!;
|
_geoPoints.value = value!;
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -1,17 +1,22 @@
|
|||||||
|
import 'package:auto_size_text/auto_size_text.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:carousel_slider/carousel_slider.dart';
|
import 'package:carousel_slider/carousel_slider.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||||
import 'package:manager_api/api.dart';
|
import 'package:manager_api/api.dart';
|
||||||
import 'package:photo_view/photo_view.dart';
|
import 'package:photo_view/photo_view.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
import 'package:tablet_app/Components/loading_common.dart';
|
||||||
import 'package:tablet_app/Components/show_element_for_resource.dart';
|
import 'package:tablet_app/Components/show_element_for_resource.dart';
|
||||||
import 'package:tablet_app/Helpers/ImageCustomProvider.dart';
|
import 'package:tablet_app/Helpers/ImageCustomProvider.dart';
|
||||||
import 'package:tablet_app/Models/map-marker.dart';
|
import 'package:tablet_app/Models/map-marker.dart';
|
||||||
import 'package:tablet_app/Models/tabletContext.dart';
|
import 'package:tablet_app/Models/tabletContext.dart';
|
||||||
import 'package:tablet_app/Screens/Quizz/quizz_view.dart';
|
import 'package:tablet_app/Screens/Quizz/quizz_view.dart';
|
||||||
import 'package:tablet_app/app_context.dart';
|
import 'package:tablet_app/app_context.dart';
|
||||||
|
import 'package:html/parser.dart' show parse;
|
||||||
|
|
||||||
import '../../constants.dart';
|
import '../../constants.dart';
|
||||||
import 'map_context.dart';
|
import 'map_context.dart';
|
||||||
@ -45,31 +50,31 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
|
|||||||
final mapContext = Provider.of<MapContext>(context);
|
final mapContext = Provider.of<MapContext>(context);
|
||||||
final appContext = Provider.of<AppContext>(context);
|
final appContext = Provider.of<AppContext>(context);
|
||||||
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
||||||
|
var language = tabletAppContext.language;
|
||||||
|
GeoPointDTO? selectedPoint = mapContext.getSelectedPoint() as GeoPointDTO?;
|
||||||
|
|
||||||
Size sizeMarker = Size(size.width * 0.42, size.height * 0.8);
|
Color primaryColor = new Color(int.parse(tabletAppContext.configuration!.primaryColor!.split('(0x')[1].split(')')[0], radix: 16));
|
||||||
return new AnimatedPositioned(
|
|
||||||
duration: const Duration(milliseconds: 1500),
|
Size sizeMarker = Size(size.width * 0.9, size.height * 0.8);
|
||||||
curve: Curves.easeInOutSine,
|
return Center(
|
||||||
left: 25, // 140
|
|
||||||
top: 10, // 150
|
|
||||||
child: Visibility(
|
child: Visibility(
|
||||||
visible: (mapContext.getSelectedMarker() as MapMarker).longitude != null,
|
visible: selectedPoint != null,
|
||||||
child: Container(
|
child: Container(
|
||||||
width: sizeMarker.width,
|
width: sizeMarker.width,
|
||||||
height: sizeMarker.height,
|
height: sizeMarker.height,
|
||||||
margin: EdgeInsets.symmetric(vertical: 3, horizontal: 4),
|
margin: EdgeInsets.symmetric(vertical: 3, horizontal: 4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: kBackgroundLight, // Colors.amberAccent //kBackgroundLight,
|
color: kBackgroundColor, // Colors.amberAccent //kBackgroundLight,
|
||||||
shape: BoxShape.rectangle,
|
//shape: BoxShape.rectangle,
|
||||||
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 10.0),
|
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 10.0),
|
||||||
boxShadow: [
|
/*boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: kBackgroundSecondGrey,
|
color: kBackgroundSecondGrey,
|
||||||
spreadRadius: 0.5,
|
spreadRadius: 0.5,
|
||||||
blurRadius: 1.1,
|
blurRadius: 1.1,
|
||||||
offset: Offset(0, 1.1), // changes position of shadow
|
offset: Offset(0, 1.1), // changes position of shadow
|
||||||
),
|
),
|
||||||
],
|
],*/
|
||||||
),
|
),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: <Widget> [
|
children: <Widget> [
|
||||||
@ -79,18 +84,18 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
mapContext.setSelectedMarker(new MapMarker(longitude: null, latitude: null, title: '', contents: null, description: ''));
|
mapContext.setSelectedPoint(null);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 50,
|
width: 50,
|
||||||
height: 50,
|
height: 50,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: kMainGrey,
|
color: kBackgroundGrey,
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: kMainGrey,
|
color: kBackgroundGrey,
|
||||||
spreadRadius: 0.5,
|
spreadRadius: 0.5,
|
||||||
blurRadius: 1.1,
|
blurRadius: 1.1,
|
||||||
offset: Offset(0, 1.1), // changes position of shadow
|
offset: Offset(0, 1.1), // changes position of shadow
|
||||||
@ -105,7 +110,211 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
if(selectedPoint != null)
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
selectedPoint.imageResourceId != null && selectedPoint.imageUrl != null ? ClipRRect(
|
||||||
|
borderRadius: BorderRadius.only(topLeft: Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0), bottomLeft: Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)),
|
||||||
|
child: Container(
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(right: BorderSide(width: 0.05, color: kMainGrey)),
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
width: size.width * 0.17,
|
||||||
|
height: size.height,
|
||||||
|
child: CachedNetworkImage(
|
||||||
|
imageUrl: selectedPoint.imageUrl!,
|
||||||
|
width: size.width,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
progressIndicatorBuilder: (context, url, downloadProgress) {
|
||||||
|
return Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: 50,
|
||||||
|
height: 50,
|
||||||
|
child: LoadingCommon(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
): SizedBox(),
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 8.0, left: 15.0),
|
||||||
|
child: Container(
|
||||||
|
//color: Colors.green,
|
||||||
|
height: size.height * 0.06,
|
||||||
|
width: size.width * 0.65,
|
||||||
|
child: HtmlWidget(
|
||||||
|
selectedPoint.title!.firstWhere((t) => t.language == language).value!,
|
||||||
|
textStyle: TextStyle(fontSize: 23.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15),
|
||||||
|
child: Container(
|
||||||
|
height: size.height * 0.7,
|
||||||
|
width: size.width * 0.38,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: kBackgroundLight,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0))
|
||||||
|
),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20, right: 10, bottom: 10, top: 15),
|
||||||
|
child: Scrollbar(
|
||||||
|
thumbVisibility: true,
|
||||||
|
thickness: 2.0,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
if(selectedPoint.description!.any((d) => d.language == language) && selectedPoint.description!.firstWhere((d) => d.language == language).value != null && selectedPoint.description!.firstWhere((d) => d.language == language).value!.trim().length > 0)
|
||||||
|
HtmlWidget(
|
||||||
|
selectedPoint.description!.firstWhere((d) => d.language == language).value!,
|
||||||
|
customStylesBuilder: (element) {
|
||||||
|
return {'text-align': 'left'};
|
||||||
|
},
|
||||||
|
textStyle: TextStyle(fontSize: kDescriptionSize),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
width: size.width * 0.32,
|
||||||
|
height: size.height * 0.7,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
//color: Colors.green,
|
||||||
|
height: size.height * 0.35,
|
||||||
|
child: CarouselSlider(
|
||||||
|
carouselController: sliderController,
|
||||||
|
options: CarouselOptions(
|
||||||
|
onPageChanged: (int index, CarouselPageChangedReason reason) {
|
||||||
|
currentIndex.value = index + 1;
|
||||||
|
},
|
||||||
|
height: size.height *0.33,
|
||||||
|
enlargeCenterPage: true,
|
||||||
|
pageSnapping: true,
|
||||||
|
reverse: false,
|
||||||
|
),
|
||||||
|
items: selectedPoint.contents!.map<Widget>((ContentGeoPoint i) {
|
||||||
|
return Builder(
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
AppContext appContext = Provider.of<AppContext>(context);
|
||||||
|
var resourcetoShow = getElementForResource(context, appContext, i, true);
|
||||||
|
return resourcetoShow;
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
//color: Colors.yellow,
|
||||||
|
height: size.height * 0.33,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 10.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
selectedPoint.prices != null && selectedPoint.prices!.isNotEmpty && selectedPoint.prices!.any((d) => d.language == language) && selectedPoint.prices!.firstWhere((d) => d.language == language).value != null && selectedPoint.prices!.firstWhere((d) => d.language == language).value!.trim().length > 0 ? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.price_change_outlined, color: primaryColor, size: 13),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
child: Text(parse(selectedPoint.prices!.firstWhere((p) => p.language == language).value!).documentElement!.text, style: TextStyle(fontSize: 12)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
): SizedBox(),
|
||||||
|
selectedPoint.phone != null && selectedPoint.phone!.isNotEmpty && selectedPoint.phone!.any((d) => d.language == language) && selectedPoint.phone!.firstWhere((d) => d.language == language).value != null && selectedPoint.phone!.firstWhere((d) => d.language == language).value!.trim().length > 0 ? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.phone, color: primaryColor, size: 13),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
child: Text(parse(selectedPoint.phone!.firstWhere((p) => p.language == language).value!).documentElement!.text, style: TextStyle(fontSize: 12)),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
): SizedBox(),
|
||||||
|
selectedPoint.email != null && selectedPoint.email!.isNotEmpty && selectedPoint.email!.any((d) => d.language == language) && selectedPoint.email!.firstWhere((d) => d.language == language).value != null && selectedPoint.email!.firstWhere((d) => d.language == language).value!.trim().length > 0 ? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.email, color: primaryColor, size: 13),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
child: SizedBox(
|
||||||
|
width: size.width*0.25,
|
||||||
|
child: AutoSizeText(parse(selectedPoint.email!.firstWhere((p) => p.language == language).value!).documentElement!.text, style: TextStyle(fontSize: 12), maxLines: 3)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
): SizedBox(),
|
||||||
|
selectedPoint.site != null && selectedPoint.site!.isNotEmpty && selectedPoint.site!.any((d) => d.language == language) && selectedPoint.site!.firstWhere((d) => d.language == language).value != null && selectedPoint.site!.firstWhere((d) => d.language == language).value!.trim().length > 0 ? Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.public, color: primaryColor, size: 13),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(4.0),
|
||||||
|
child: SizedBox(
|
||||||
|
width: size.width*0.25,
|
||||||
|
child: AutoSizeText(parse(selectedPoint.site!.firstWhere((p) => p.language == language).value!).documentElement!.text, style: TextStyle(fontSize: 12), maxLines: 3)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
): SizedBox(),
|
||||||
|
selectedPoint.site != null && selectedPoint.site!.isNotEmpty && selectedPoint.site!.any((d) => d.language == language) && selectedPoint.site!.firstWhere((d) => d.language == language).value != null && selectedPoint.site!.firstWhere((d) => d.language == language).value!.trim().length > 0 ? Expanded(
|
||||||
|
child: Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
width: size.width *0.1,
|
||||||
|
height: 120,
|
||||||
|
child: QrImageView(
|
||||||
|
padding: EdgeInsets.only(left: 5.0, top: 5.0, bottom: 5.0, right: 5.0),
|
||||||
|
data: parse(selectedPoint.site!.firstWhere((p) => p.language == language).value!).documentElement!.text,
|
||||||
|
version: QrVersions.auto,
|
||||||
|
size: 50.0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
): SizedBox(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
/*Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(top: 20),
|
padding: const EdgeInsets.only(top: 20),
|
||||||
@ -250,54 +459,128 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),*/
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getElementForResource(BuildContext context, AppContext appContext, ContentGeoPoint i) {
|
getElementForResource(BuildContext context, AppContext appContext, ContentGeoPoint i, bool addFullScreen) {
|
||||||
var widgetToInclude;
|
var widgetToInclude;
|
||||||
final appContext = Provider.of<AppContext>(context);
|
Size size = MediaQuery.of(context).size;
|
||||||
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
||||||
|
|
||||||
switch(i.resourceType) {
|
switch(i.resourceType) {
|
||||||
case ResourceType.Image:
|
case ResourceType.Image:
|
||||||
case ResourceType.ImageUrl:
|
case ResourceType.ImageUrl:
|
||||||
widgetToInclude = AspectRatio(
|
widgetToInclude = GestureDetector(
|
||||||
aspectRatio: 16 / 9,
|
onTap: () {
|
||||||
child: ClipRect(
|
if(addFullScreen) {
|
||||||
child: i.resourceUrl != null ? PhotoView(
|
showDialog(
|
||||||
imageProvider: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resourceUrl!),
|
context: context,
|
||||||
minScale: PhotoViewComputedScale.contained * 0.8,
|
builder: (BuildContext context) {
|
||||||
maxScale: PhotoViewComputedScale.contained * 3.0,
|
return AlertDialog(
|
||||||
backgroundDecoration: BoxDecoration(
|
shape: RoundedRectangleBorder(
|
||||||
color: kBackgroundSecondGrey,
|
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0))
|
||||||
shape: BoxShape.rectangle,
|
),
|
||||||
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0),
|
contentPadding: EdgeInsets.zero,
|
||||||
|
// title: Text(eventAgenda.name!),
|
||||||
|
content: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)),
|
||||||
|
color: kBackgroundColor,
|
||||||
|
),
|
||||||
|
height: size.height * 0.8,
|
||||||
|
width: size.width * 0.8,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
//color: Colors.yellow,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)),
|
||||||
|
),
|
||||||
|
child: PhotoView(
|
||||||
|
imageProvider: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resourceUrl!),
|
||||||
|
minScale: PhotoViewComputedScale.contained * 0.8,
|
||||||
|
maxScale: PhotoViewComputedScale.contained * 3.0,
|
||||||
|
backgroundDecoration: BoxDecoration(
|
||||||
|
color: kBackgroundGrey,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
//color: kBackgroundLight,
|
||||||
|
image: DecorationImage(
|
||||||
|
image: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resourceUrl!),
|
||||||
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
) : Center(child: Text('No data')),
|
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)),
|
||||||
|
/*border: Border.all(
|
||||||
|
color: kBackgroundGrey,
|
||||||
|
width: 1.0,
|
||||||
|
),*/
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case ResourceType.Video:
|
case ResourceType.Video:
|
||||||
case ResourceType.VideoUrl:
|
case ResourceType.VideoUrl:
|
||||||
case ResourceType.Audio:
|
case ResourceType.Audio:
|
||||||
widgetToInclude = Container(
|
widgetToInclude = GestureDetector(
|
||||||
decoration: BoxDecoration(
|
behavior: HitTestBehavior.translucent,
|
||||||
color: kBackgroundSecondGrey,
|
onTap: () {
|
||||||
shape: BoxShape.rectangle,
|
if(addFullScreen && i.resourceType != ResourceType.Audio) {
|
||||||
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0),
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0))
|
||||||
|
),
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
// title: Text(eventAgenda.name!),
|
||||||
|
content: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)),
|
||||||
|
color: kBackgroundColor,
|
||||||
|
),
|
||||||
|
height: size.height * 0.8,
|
||||||
|
width: size.width * 0.8,
|
||||||
|
child: Center(child: showElementForResource(ResourceDTO(id: i.resourceId, url: i.resourceUrl, type: i.resourceType), appContext, false, true)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: IgnorePointer(
|
||||||
|
ignoring: i.resourceType != ResourceType.Audio,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.yellow,
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0),
|
||||||
|
),
|
||||||
|
child: showElementForResource(ResourceDTO(id: i.resourceId, url: i.resourceUrl, type: i.resourceType), appContext, false, true),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: showElementForResource(ResourceDTO(id: i.resourceId, url: i.resourceUrl, type: i.resourceType), appContext, false, true),
|
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Center(
|
return Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.6,
|
||||||
|
width: MediaQuery.of(context).size.width * 0.72,
|
||||||
child: AspectRatio(
|
child: AspectRatio(
|
||||||
aspectRatio: 16 / 9,
|
aspectRatio: 16 / 9,
|
||||||
child: ClipRect(
|
child: ClipRect(
|
||||||
@ -307,4 +590,3 @@ getElementForResource(BuildContext context, AppContext appContext, ContentGeoPoi
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import 'package:tablet_app/Models/map-marker.dart';
|
|||||||
import 'package:tablet_app/Models/tabletContext.dart';
|
import 'package:tablet_app/Models/tabletContext.dart';
|
||||||
import 'package:tablet_app/Screens/Agenda/agenda_view.dart';
|
import 'package:tablet_app/Screens/Agenda/agenda_view.dart';
|
||||||
import 'package:tablet_app/Screens/MainView/main_view.dart';
|
import 'package:tablet_app/Screens/MainView/main_view.dart';
|
||||||
|
import 'package:tablet_app/Screens/MainView/section_page_detail.dart';
|
||||||
import 'package:tablet_app/Screens/Map/map_context.dart';
|
import 'package:tablet_app/Screens/Map/map_context.dart';
|
||||||
import 'package:tablet_app/Screens/Map/map_view.dart';
|
import 'package:tablet_app/Screens/Map/map_view.dart';
|
||||||
import 'package:tablet_app/Screens/PDF/pdf_view.dart';
|
import 'package:tablet_app/Screens/PDF/pdf_view.dart';
|
||||||
@ -43,7 +44,7 @@ class _MenuView extends State<MenuView> {
|
|||||||
menuDTO = MenuDTO.fromJson(jsonDecode(widget.section.data!))!;
|
menuDTO = MenuDTO.fromJson(jsonDecode(widget.section.data!))!;
|
||||||
print(menuDTO);
|
print(menuDTO);
|
||||||
|
|
||||||
isImageBackground = true; //widget.isImageBackground;
|
isImageBackground = widget.isImageBackground;
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
@ -58,212 +59,99 @@ class _MenuView extends State<MenuView> {
|
|||||||
final appContext = Provider.of<AppContext>(context);
|
final appContext = Provider.of<AppContext>(context);
|
||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
||||||
|
ConfigurationDTO configurationDTO = appContext.getContext().configuration;
|
||||||
|
Color backgroundColor = appContext.getContext().configuration != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)) : Colors.white;
|
||||||
|
Color textColor = backgroundColor.computeLuminance() > 0.5 ? Colors.black : Colors.white;
|
||||||
|
|
||||||
if (selectedSection != null) {
|
return Center(
|
||||||
var elementToShow;
|
child: GridView.builder(
|
||||||
switch (selectedSection!.type) {
|
shrinkWrap: true,
|
||||||
case SectionType.Map :
|
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: kIsWeb ? 1.7 : 1.4),
|
||||||
elementToShow = ChangeNotifierProvider<MapContext>(
|
itemCount: menuDTO.sections!.length,
|
||||||
create: (_) =>
|
itemBuilder: (BuildContext context, int index) {
|
||||||
MapContext(new MapMarker(
|
return InkWell(
|
||||||
latitude: null,
|
onTap: () async {
|
||||||
longitude: null,
|
SectionDTO? section = await (appContext.getContext() as TabletAppContext).clientAPI!.sectionApi!.sectionGetDetail(menuDTO.sections![index].id!);
|
||||||
title: '',
|
setState(() {
|
||||||
description: '')),
|
//selectedSection = section;
|
||||||
child: FutureBuilder(
|
//selectedSection = menuDTO.sections![index];
|
||||||
future: getByteIcons(selectedSection!),
|
Navigator.push(
|
||||||
builder: (context, AsyncSnapshot<dynamic> snapshot) {
|
context,
|
||||||
if (snapshot.connectionState == ConnectionState.done) {
|
MaterialPageRoute(
|
||||||
return MapViewWidget(section: selectedSection!, icons: snapshot.data);
|
builder: (context) {
|
||||||
} else if (snapshot.connectionState == ConnectionState.none) {
|
return SectionPageDetail(configurationDTO: configurationDTO, sectionDTO: section!, textColor: textColor, isImageBackground: isImageBackground, elementToShow: getContent(tabletAppContext, section, isImageBackground), isFromMenu: true);
|
||||||
return Text("No data");
|
},
|
||||||
} else {
|
),// For pushAndRemoveUntil
|
||||||
return Center(
|
);
|
||||||
child: Container(
|
});
|
||||||
child: LoadingCommon()
|
},
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
) /*FutureBuilder(
|
|
||||||
future: _url,
|
|
||||||
builder: (BuildContext context, AsyncSnapshot snapshot) => snapshot.hasData
|
|
||||||
? WebViewWidget(url: snapshot.data,)
|
|
||||||
: CircularProgressIndicator()),*/
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case SectionType.Web : // WEB
|
|
||||||
elementToShow = WebView(section: selectedSection);
|
|
||||||
break;
|
|
||||||
case SectionType.Video : // Video
|
|
||||||
elementToShow = VideoView(section: selectedSection);
|
|
||||||
break;
|
|
||||||
case SectionType.Slider : // Slider
|
|
||||||
elementToShow = SliderView(section: selectedSection);
|
|
||||||
break;
|
|
||||||
case SectionType.Quizz : // Quizz
|
|
||||||
elementToShow = QuizzView(section: selectedSection);
|
|
||||||
break;
|
|
||||||
case SectionType.Pdf : // Pdf
|
|
||||||
elementToShow = PDFViewWidget(section: selectedSection);
|
|
||||||
break;
|
|
||||||
case SectionType.Puzzle : // Puzzle
|
|
||||||
elementToShow = PuzzleView(section: selectedSection);
|
|
||||||
break;
|
|
||||||
case SectionType.Agenda : // Agenda
|
|
||||||
elementToShow = AgendaView(section: selectedSection);
|
|
||||||
break;
|
|
||||||
/*case SectionType.article : // Article
|
|
||||||
elementToShow = ArticleView(section: selectedSection);
|
|
||||||
break;*/
|
|
||||||
default:
|
|
||||||
elementToShow = Text('Section type not supported');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return Stack(
|
|
||||||
children: [
|
|
||||||
Center(
|
|
||||||
child: Padding(
|
|
||||||
padding: selectedSection!.type == SectionType.Video || selectedSection!.type == SectionType.Web ? EdgeInsets.all(8.0) : EdgeInsets.all(0.0),
|
|
||||||
child: Container(
|
child: Container(
|
||||||
width: size.width,
|
decoration: isImageBackground ? boxDecoration(appContext, menuDTO.sections![index], false) : null,
|
||||||
decoration: selectedSection!.type != SectionType.Video && selectedSection!.type != SectionType.Web && selectedSection!.type != SectionType.Slider && selectedSection!.type != SectionType.Map ? BoxDecoration(
|
padding: const EdgeInsets.all(25),
|
||||||
color: kBackgroundLight,
|
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
||||||
shape: BoxShape.rectangle,
|
child: isImageBackground ? Align(
|
||||||
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0),
|
alignment: Alignment.bottomRight,
|
||||||
boxShadow: [
|
child: FractionallySizedBox(
|
||||||
BoxShadow(
|
heightFactor: 0.5,
|
||||||
color: kBackgroundSecondGrey,
|
child: Column(
|
||||||
spreadRadius: 0.5,
|
children: [
|
||||||
blurRadius: 5,
|
Align(
|
||||||
offset: Offset(0, 1.5), // changes position of shadow
|
alignment: Alignment.centerRight,
|
||||||
),
|
child: HtmlWidget(
|
||||||
],
|
menuDTO.sections![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value!,
|
||||||
) : null,
|
customStylesBuilder: (element) {
|
||||||
child: Padding(
|
return {'text-align': 'right'};
|
||||||
padding: const EdgeInsets.only(left: 15.0, right: 15.0),
|
},
|
||||||
child: elementToShow),
|
textStyle: new TextStyle(fontSize: kIsWeb? kWebMenuTitleDetailSize : kMenuTitleDetailSize),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 5, right: 5),
|
|
||||||
child: Align(
|
|
||||||
alignment: Alignment.bottomRight,
|
|
||||||
child: InkWell(
|
|
||||||
onTap: () {
|
|
||||||
setState(() {
|
|
||||||
selectedSection = null;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: appContext.getContext().configuration == null ? kBackgroundGrey : appContext.getContext().configuration.secondaryColor != null ? new Color(int.parse(appContext.getContext().configuration.secondaryColor.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey,
|
|
||||||
shape: BoxShape.rectangle,
|
|
||||||
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0),
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: kBackgroundSecondGrey,
|
|
||||||
spreadRadius: 0.5,
|
|
||||||
blurRadius: 5,
|
|
||||||
offset: Offset(0, 1.5), // changes position of shadow
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Icons.arrow_back,
|
|
||||||
size: 95,
|
|
||||||
color: kMainGrey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Center(
|
|
||||||
child: GridView.builder(
|
|
||||||
shrinkWrap: true,
|
|
||||||
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: kIsWeb ? 1.7 : 1.4),
|
|
||||||
itemCount: menuDTO.sections!.length,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
return InkWell(
|
|
||||||
onTap: () async {
|
|
||||||
SectionDTO? section = await (appContext.getContext() as TabletAppContext).clientAPI!.sectionApi!.sectionGetDetail(menuDTO.sections![index].id!);
|
|
||||||
setState(() {
|
|
||||||
selectedSection = section;
|
|
||||||
//selectedSection = menuDTO.sections![index];
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
decoration: isImageBackground ? boxDecoration(appContext, menuDTO.sections![index], false) : null,
|
|
||||||
padding: const EdgeInsets.all(25),
|
|
||||||
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
|
|
||||||
child: isImageBackground ? Align(
|
|
||||||
alignment: Alignment.bottomRight,
|
|
||||||
child: FractionallySizedBox(
|
|
||||||
heightFactor: 0.5,
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: HtmlWidget(
|
|
||||||
menuDTO.sections![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value!,
|
|
||||||
customStylesBuilder: (element) {
|
|
||||||
return {'text-align': 'right'};
|
|
||||||
},
|
|
||||||
textStyle: new TextStyle(fontSize: kIsWeb? kWebMenuTitleDetailSize : kMenuTitleDetailSize),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
/*Align(
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
child: HtmlWidget(
|
|
||||||
menuDTO.sections![index].description!.firstWhere((translation) => translation.language == appContext.getContext().language).value!,
|
|
||||||
customStylesBuilder: (element) {
|
|
||||||
return {'text-align': 'right'};
|
|
||||||
},
|
|
||||||
textStyle: new TextStyle(fontSize: kIsWeb? kWebSectionDescriptionDetailSize: kSectionDescriptionDetailSize, fontFamily: ""),
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
],
|
|
||||||
)
|
|
||||||
),
|
|
||||||
) : Column(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
flex: 8,
|
|
||||||
child: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: menuDTO.sections![index].imageSource == null ? kBackgroundColor : null, // default color if no image
|
|
||||||
shape: BoxShape.rectangle,
|
|
||||||
image: menuDTO.sections![index].imageSource != null ? new DecorationImage(
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: ImageCustomProvider.getImageProvider(appContext, menuDTO.sections![index].imageId!, menuDTO.sections![index].imageSource!),
|
|
||||||
): null,
|
|
||||||
),
|
),
|
||||||
)
|
/*Align(
|
||||||
),
|
alignment: Alignment.centerRight,
|
||||||
Expanded(
|
child: HtmlWidget(
|
||||||
flex: 2,
|
menuDTO.sections![index].description!.firstWhere((translation) => translation.language == appContext.getContext().language).value!,
|
||||||
child: Center(
|
customStylesBuilder: (element) {
|
||||||
child: HtmlWidget(
|
return {'text-align': 'right'};
|
||||||
menuDTO.sections![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value ?? "",
|
},
|
||||||
customStylesBuilder: (element) {
|
textStyle: new TextStyle(fontSize: kIsWeb? kWebSectionDescriptionDetailSize: kSectionDescriptionDetailSize, fontFamily: ""),
|
||||||
return {'text-align': 'center', 'font-family': "Roboto"};
|
),
|
||||||
},
|
),*/
|
||||||
textStyle: TextStyle(fontSize: 25),//calculateFontSize(constraints.maxWidth, constraints.maxHeight, kIsWeb ? kWebMenuTitleDetailSize : kMenuTitleDetailSize)),
|
],
|
||||||
),
|
)
|
||||||
)
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
) : Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: 8,
|
||||||
|
child: Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: menuDTO.sections![index].imageSource == null ? kBackgroundColor : null, // default color if no image
|
||||||
|
shape: BoxShape.rectangle,
|
||||||
|
image: menuDTO.sections![index].imageSource != null ? new DecorationImage(
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
image: ImageCustomProvider.getImageProvider(appContext, menuDTO.sections![index].imageId!, menuDTO.sections![index].imageSource!),
|
||||||
|
): null,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 2,
|
||||||
|
child: Center(
|
||||||
|
child: HtmlWidget(
|
||||||
|
menuDTO.sections![index].title!.firstWhere((translation) => translation.language == appContext.getContext().language).value ?? "",
|
||||||
|
customStylesBuilder: (element) {
|
||||||
|
return {'text-align': 'center', 'font-family': "Roboto"};
|
||||||
|
},
|
||||||
|
textStyle: TextStyle(fontSize: 25),//calculateFontSize(constraints.maxWidth, constraints.maxHeight, kIsWeb ? kWebMenuTitleDetailSize : kMenuTitleDetailSize)),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
}
|
);
|
||||||
),
|
}
|
||||||
);
|
),
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -265,11 +265,7 @@ class _PreviousViewWidget extends State<PreviousViewWidget> with TickerProviderS
|
|||||||
height: size.height,
|
height: size.height,
|
||||||
child: ChangeNotifierProvider<MapContext>(
|
child: ChangeNotifierProvider<MapContext>(
|
||||||
create: (_) =>
|
create: (_) =>
|
||||||
MapContext(new MapMarker(
|
MapContext(null),
|
||||||
latitude: null,
|
|
||||||
longitude: null,
|
|
||||||
title: '',
|
|
||||||
description: '')),
|
|
||||||
child: MapViewWidget(section: SectionDTO(), icons: []) /*FutureBuilder(
|
child: MapViewWidget(section: SectionDTO(), icons: []) /*FutureBuilder(
|
||||||
future: _url,
|
future: _url,
|
||||||
builder: (BuildContext context, AsyncSnapshot snapshot) => snapshot.hasData
|
builder: (BuildContext context, AsyncSnapshot snapshot) => snapshot.hasData
|
||||||
|
|||||||
@ -2153,6 +2153,12 @@ components:
|
|||||||
nullable: true
|
nullable: true
|
||||||
items:
|
items:
|
||||||
$ref: '#/components/schemas/CategorieDTO'
|
$ref: '#/components/schemas/CategorieDTO'
|
||||||
|
latitude:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
longitude:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
MapTypeApp:
|
MapTypeApp:
|
||||||
type: integer
|
type: integer
|
||||||
description: |-
|
description: |-
|
||||||
@ -2247,6 +2253,12 @@ components:
|
|||||||
longitude:
|
longitude:
|
||||||
type: string
|
type: string
|
||||||
nullable: true
|
nullable: true
|
||||||
|
imageResourceId:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
|
imageUrl:
|
||||||
|
type: string
|
||||||
|
nullable: true
|
||||||
schedules:
|
schedules:
|
||||||
type: array
|
type: array
|
||||||
nullable: true
|
nullable: true
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:manager_api/api.dart';
|
|||||||
## Properties
|
## Properties
|
||||||
Name | Type | Description | Notes
|
Name | Type | Description | Notes
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**id** | **int** | | [optional]
|
||||||
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
**label** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||||
**icon** | **String** | | [optional]
|
**icon** | **String** | | [optional]
|
||||||
**iconResourceId** | **String** | | [optional]
|
**iconResourceId** | **String** | | [optional]
|
||||||
|
|||||||
@ -16,6 +16,8 @@ Name | Type | Description | Notes
|
|||||||
**categorieId** | **int** | | [optional]
|
**categorieId** | **int** | | [optional]
|
||||||
**latitude** | **String** | | [optional]
|
**latitude** | **String** | | [optional]
|
||||||
**longitude** | **String** | | [optional]
|
**longitude** | **String** | | [optional]
|
||||||
|
**imageResourceId** | **String** | | [optional]
|
||||||
|
**imageUrl** | **String** | | [optional]
|
||||||
**schedules** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
**schedules** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||||
**prices** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
**prices** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||||
**phone** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
**phone** | [**List<TranslationDTO>**](TranslationDTO.md) | | [optional] [default to const []]
|
||||||
|
|||||||
@ -16,6 +16,8 @@ Name | Type | Description | Notes
|
|||||||
**iconResourceId** | **String** | | [optional]
|
**iconResourceId** | **String** | | [optional]
|
||||||
**iconSource** | **String** | | [optional]
|
**iconSource** | **String** | | [optional]
|
||||||
**categories** | [**List<CategorieDTO>**](CategorieDTO.md) | | [optional] [default to const []]
|
**categories** | [**List<CategorieDTO>**](CategorieDTO.md) | | [optional] [default to const []]
|
||||||
|
**latitude** | **String** | | [optional]
|
||||||
|
**longitude** | **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)
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,8 @@ class GeoPointDTO {
|
|||||||
this.categorieId,
|
this.categorieId,
|
||||||
this.latitude,
|
this.latitude,
|
||||||
this.longitude,
|
this.longitude,
|
||||||
|
this.imageResourceId,
|
||||||
|
this.imageUrl,
|
||||||
this.schedules = const [],
|
this.schedules = const [],
|
||||||
this.prices = const [],
|
this.prices = const [],
|
||||||
this.phone = const [],
|
this.phone = const [],
|
||||||
@ -44,6 +46,10 @@ class GeoPointDTO {
|
|||||||
|
|
||||||
String? longitude;
|
String? longitude;
|
||||||
|
|
||||||
|
String? imageResourceId;
|
||||||
|
|
||||||
|
String? imageUrl;
|
||||||
|
|
||||||
List<TranslationDTO>? schedules;
|
List<TranslationDTO>? schedules;
|
||||||
|
|
||||||
List<TranslationDTO>? prices;
|
List<TranslationDTO>? prices;
|
||||||
@ -64,6 +70,8 @@ class GeoPointDTO {
|
|||||||
other.categorieId == categorieId &&
|
other.categorieId == categorieId &&
|
||||||
other.latitude == latitude &&
|
other.latitude == latitude &&
|
||||||
other.longitude == longitude &&
|
other.longitude == longitude &&
|
||||||
|
other.imageResourceId == imageResourceId &&
|
||||||
|
other.imageUrl == imageUrl &&
|
||||||
other.schedules == schedules &&
|
other.schedules == schedules &&
|
||||||
other.prices == prices &&
|
other.prices == prices &&
|
||||||
other.phone == phone &&
|
other.phone == phone &&
|
||||||
@ -81,6 +89,8 @@ class GeoPointDTO {
|
|||||||
(categorieId == null ? 0 : categorieId!.hashCode) +
|
(categorieId == null ? 0 : categorieId!.hashCode) +
|
||||||
(latitude == null ? 0 : latitude!.hashCode) +
|
(latitude == null ? 0 : latitude!.hashCode) +
|
||||||
(longitude == null ? 0 : longitude!.hashCode) +
|
(longitude == null ? 0 : longitude!.hashCode) +
|
||||||
|
(imageResourceId == null ? 0 : imageResourceId!.hashCode) +
|
||||||
|
(imageUrl == null ? 0 : imageUrl!.hashCode) +
|
||||||
(schedules == null ? 0 : schedules!.hashCode) +
|
(schedules == null ? 0 : schedules!.hashCode) +
|
||||||
(prices == null ? 0 : prices!.hashCode) +
|
(prices == null ? 0 : prices!.hashCode) +
|
||||||
(phone == null ? 0 : phone!.hashCode) +
|
(phone == null ? 0 : phone!.hashCode) +
|
||||||
@ -88,7 +98,7 @@ class GeoPointDTO {
|
|||||||
(site == null ? 0 : site!.hashCode);
|
(site == null ? 0 : site!.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, contents=$contents, categorie=$categorie, categorieId=$categorieId, latitude=$latitude, longitude=$longitude, schedules=$schedules, prices=$prices, phone=$phone, email=$email, site=$site]';
|
String toString() => 'GeoPointDTO[id=$id, title=$title, description=$description, contents=$contents, categorie=$categorie, categorieId=$categorieId, latitude=$latitude, longitude=$longitude, imageResourceId=$imageResourceId, imageUrl=$imageUrl, schedules=$schedules, prices=$prices, phone=$phone, email=$email, site=$site]';
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
@ -132,6 +142,16 @@ class GeoPointDTO {
|
|||||||
} else {
|
} else {
|
||||||
json[r'longitude'] = null;
|
json[r'longitude'] = null;
|
||||||
}
|
}
|
||||||
|
if (this.imageResourceId != null) {
|
||||||
|
json[r'imageResourceId'] = this.imageResourceId;
|
||||||
|
} else {
|
||||||
|
json[r'imageResourceId'] = null;
|
||||||
|
}
|
||||||
|
if (this.imageUrl != null) {
|
||||||
|
json[r'imageUrl'] = this.imageUrl;
|
||||||
|
} else {
|
||||||
|
json[r'imageUrl'] = null;
|
||||||
|
}
|
||||||
if (this.schedules != null) {
|
if (this.schedules != null) {
|
||||||
json[r'schedules'] = this.schedules;
|
json[r'schedules'] = this.schedules;
|
||||||
} else {
|
} else {
|
||||||
@ -187,6 +207,8 @@ class GeoPointDTO {
|
|||||||
categorieId: mapValueOfType<int>(json, r'categorieId'),
|
categorieId: mapValueOfType<int>(json, r'categorieId'),
|
||||||
latitude: mapValueOfType<String>(json, r'latitude'),
|
latitude: mapValueOfType<String>(json, r'latitude'),
|
||||||
longitude: mapValueOfType<String>(json, r'longitude'),
|
longitude: mapValueOfType<String>(json, r'longitude'),
|
||||||
|
imageResourceId: mapValueOfType<String>(json, r'imageResourceId'),
|
||||||
|
imageUrl: mapValueOfType<String>(json, r'imageUrl'),
|
||||||
schedules: TranslationDTO.listFromJson(json[r'schedules']),
|
schedules: TranslationDTO.listFromJson(json[r'schedules']),
|
||||||
prices: TranslationDTO.listFromJson(json[r'prices']),
|
prices: TranslationDTO.listFromJson(json[r'prices']),
|
||||||
phone: TranslationDTO.listFromJson(json[r'phone']),
|
phone: TranslationDTO.listFromJson(json[r'phone']),
|
||||||
|
|||||||
@ -21,6 +21,8 @@ class MapDTO {
|
|||||||
this.iconResourceId,
|
this.iconResourceId,
|
||||||
this.iconSource,
|
this.iconSource,
|
||||||
this.categories = const [],
|
this.categories = const [],
|
||||||
|
this.latitude,
|
||||||
|
this.longitude,
|
||||||
});
|
});
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -45,31 +47,39 @@ class MapDTO {
|
|||||||
|
|
||||||
List<CategorieDTO>? categories;
|
List<CategorieDTO>? categories;
|
||||||
|
|
||||||
|
String? latitude;
|
||||||
|
|
||||||
|
String? longitude;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) => identical(this, other) || other is MapDTO &&
|
bool operator ==(Object other) => identical(this, other) || other is MapDTO &&
|
||||||
other.zoom == zoom &&
|
other.zoom == zoom &&
|
||||||
other.mapType == mapType &&
|
other.mapType == mapType &&
|
||||||
other.mapTypeMapbox == mapTypeMapbox &&
|
other.mapTypeMapbox == mapTypeMapbox &&
|
||||||
other.mapProvider == mapProvider &&
|
other.mapProvider == mapProvider &&
|
||||||
other.points == points &&
|
other.points == points &&
|
||||||
other.iconResourceId == iconResourceId &&
|
other.iconResourceId == iconResourceId &&
|
||||||
other.iconSource == iconSource &&
|
other.iconSource == iconSource &&
|
||||||
other.categories == categories;
|
other.categories == categories &&
|
||||||
|
other.latitude == latitude &&
|
||||||
|
other.longitude == longitude;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode =>
|
int get hashCode =>
|
||||||
// ignore: unnecessary_parenthesis
|
// ignore: unnecessary_parenthesis
|
||||||
(zoom == null ? 0 : zoom!.hashCode) +
|
(zoom == null ? 0 : zoom!.hashCode) +
|
||||||
(mapType == null ? 0 : mapType!.hashCode) +
|
(mapType == null ? 0 : mapType!.hashCode) +
|
||||||
(mapTypeMapbox == null ? 0 : mapTypeMapbox!.hashCode) +
|
(mapTypeMapbox == null ? 0 : mapTypeMapbox!.hashCode) +
|
||||||
(mapProvider == null ? 0 : mapProvider!.hashCode) +
|
(mapProvider == null ? 0 : mapProvider!.hashCode) +
|
||||||
(points == null ? 0 : points!.hashCode) +
|
(points == null ? 0 : points!.hashCode) +
|
||||||
(iconResourceId == null ? 0 : iconResourceId!.hashCode) +
|
(iconResourceId == null ? 0 : iconResourceId!.hashCode) +
|
||||||
(iconSource == null ? 0 : iconSource!.hashCode) +
|
(iconSource == null ? 0 : iconSource!.hashCode) +
|
||||||
(categories == null ? 0 : categories!.hashCode);
|
(categories == null ? 0 : categories!.hashCode) +
|
||||||
|
(latitude == null ? 0 : latitude!.hashCode) +
|
||||||
|
(longitude == null ? 0 : longitude!.hashCode);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() => 'MapDTO[zoom=$zoom, mapType=$mapType, mapTypeMapbox=$mapTypeMapbox, mapProvider=$mapProvider, points=$points, iconResourceId=$iconResourceId, iconSource=$iconSource, categories=$categories]';
|
String toString() => 'MapDTO[zoom=$zoom, mapType=$mapType, mapTypeMapbox=$mapTypeMapbox, mapProvider=$mapProvider, points=$points, iconResourceId=$iconResourceId, iconSource=$iconSource, categories=$categories, latitude=$latitude, longitude=$longitude]';
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
final json = <String, dynamic>{};
|
final json = <String, dynamic>{};
|
||||||
@ -113,6 +123,16 @@ class MapDTO {
|
|||||||
} else {
|
} else {
|
||||||
json[r'categories'] = null;
|
json[r'categories'] = null;
|
||||||
}
|
}
|
||||||
|
if (this.latitude != null) {
|
||||||
|
json[r'latitude'] = this.latitude;
|
||||||
|
} else {
|
||||||
|
json[r'latitude'] = null;
|
||||||
|
}
|
||||||
|
if (this.longitude != null) {
|
||||||
|
json[r'longitude'] = this.longitude;
|
||||||
|
} else {
|
||||||
|
json[r'longitude'] = null;
|
||||||
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,6 +163,8 @@ class MapDTO {
|
|||||||
iconResourceId: mapValueOfType<String>(json, r'iconResourceId'),
|
iconResourceId: mapValueOfType<String>(json, r'iconResourceId'),
|
||||||
iconSource: mapValueOfType<String>(json, r'iconSource'),
|
iconSource: mapValueOfType<String>(json, r'iconSource'),
|
||||||
categories: CategorieDTO.listFromJson(json[r'categories']),
|
categories: CategorieDTO.listFromJson(json[r'categories']),
|
||||||
|
latitude: mapValueOfType<String>(json, r'latitude'),
|
||||||
|
longitude: mapValueOfType<String>(json, r'longitude'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
part of openapi.api;
|
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 = Quizz 6 = Article 7 = PDF 8 = Puzzle 9 = Agenda 10 = Weather
|
||||||
class SectionType {
|
class SectionType {
|
||||||
/// Instantiate a new enum with the provided [value].
|
/// Instantiate a new enum with the provided [value].
|
||||||
const SectionType._(this.value);
|
const SectionType._(this.value);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user