wip version 3.0

This commit is contained in:
Thomas Fransolet 2025-05-27 16:20:29 +02:00
parent 0cd2b47211
commit 50e2fc393f
14 changed files with 77 additions and 85 deletions

View File

@ -146,7 +146,7 @@ class _AudioPlayerFloatingContainerState extends State<AudioPlayerFloatingContai
TabletAppContext tabletAppContext = appContext.getContext();
return FloatingActionButton(
backgroundColor: new Color(int.parse(tabletAppContext.configuration!.primaryColor!.split('(0x')[1].split(')')[0], radix: 16)).withOpacity(0.7),
backgroundColor: new Color(int.parse(tabletAppContext.configuration!.primaryColor!.split('(0x')[1].split(')')[0], radix: 16)).withValues(alpha: 0.7),
onPressed: () async {
if(!isplaying && !audioplayed){
//player.play(BytesSource(audiobytes));

View File

@ -74,7 +74,7 @@ class _VideoViewer extends State<VideoViewer> {
if(!_controller.value.isPlaying && _controller.value.isInitialized)
Center(
child: FloatingActionButton(
backgroundColor: kTestSecondColor.withOpacity(0.8),
backgroundColor: kTestSecondColor.withValues(alpha: 0.8),
onPressed: () {
setState(() {
_controller.value.isPlaying

View File

@ -100,7 +100,7 @@ class _AgendaView extends State<AgendaView> {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.data == null) {
return Center(
child: Text("Le json n'est pas valide")
child: Text("Le fichier choisi n'est pas valide")
);
} else {
return Center(

View File

@ -117,7 +117,7 @@ class _MainViewWidget extends State<MainViewWidget> {
decoration: configurationDTO.imageId != null ? BoxDecoration(
image: new DecorationImage(
fit: BoxFit.cover,
colorFilter: new ColorFilter.mode(Colors.grey.withOpacity(0.1), BlendMode.color),
colorFilter: new ColorFilter.mode(Colors.grey.withValues(alpha: 0.1), BlendMode.color),
image: ImageCustomProvider.getImageProvider(appContext, configurationDTO.imageId!, configurationDTO.imageSource!)
),
) : null,
@ -281,17 +281,9 @@ class _MainViewWidget extends State<MainViewWidget> {
if(isInit) {
try {
final rawList = await tabletAppContext.clientAPI!.sectionApi!.sectionGetFromConfigurationDetail(tabletAppContext.configuration!.id!);
//var sections = rawList.map((json) => SectionDTO.fromJson(json)).toList();
rawSectionsData = jsonDecode(jsonEncode(rawList));
rawSectionsData = rawSectionsData.map((json) => SectionDTO.fromJson(json)).toList();
List<SectionDTO> sectionList = rawSectionsData.whereType<SectionDTO>().toList();
sectionList.sort((a, b) => a.order!.compareTo(b.order!));
/*List<SectionDTO>? sections = await tabletAppContext.clientAPI!.sectionApi!.sectionGetFromConfiguration(tabletAppContext.configuration!.id!);
sections!.sort((a, b) => a.order!.compareTo(b.order!));*/
List<SectionDTO> sectionList = jsonDecode(jsonEncode(rawSectionsData)).map((json) => SectionDTO.fromJson(json)).whereType<SectionDTO>().toList();
sectionsLocal = sectionList;
isInit = false;
return sectionList;
@ -342,7 +334,7 @@ class _MainViewWidget extends State<MainViewWidget> {
});
},
child: Container(
decoration: isImageBackground ? boxDecoration(appContext, sectionsLocal![index], false) : null,
decoration: isImageBackground ? boxDecoration(appContext, sectionsLocal![index], false, rawSectionsData[index]) : null,
//color: Colors.yellow,
padding: EdgeInsets.all(isImageBackground ? 18 : 5),
margin: EdgeInsets.symmetric(vertical: isImageBackground ? 25 : 10, horizontal: 25),
@ -377,7 +369,7 @@ class _MainViewWidget extends State<MainViewWidget> {
shape: BoxShape.rectangle,
image: sectionsLocal![index].imageSource != null || sectionsLocal![index].type == SectionType.Video ? new DecorationImage(
fit: BoxFit.cover,
image: ImageCustomProvider.getImageProvider(appContext, sectionsLocal![index].imageId, sectionsLocal![index].type == SectionType.Video ? getYoutubeThumbnailUrl(sectionsLocal![index]) : sectionsLocal![index].imageSource!),
image: ImageCustomProvider.getImageProvider(appContext, sectionsLocal![index].imageId, sectionsLocal![index].type == SectionType.Video ? getYoutubeThumbnailUrl(rawSectionsData[index]) : sectionsLocal![index].imageSource!),
): null,
),
)
@ -415,7 +407,7 @@ class _MainViewWidget extends State<MainViewWidget> {
}
}
boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
boxDecoration(AppContext appContext, SectionDTO section, bool isSelected, Object rawSectionData) {
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
return BoxDecoration(
color: !isSelected ? kBackgroundLight : section.imageSource == null ? kBackgroundLight : null,
@ -423,8 +415,8 @@ boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 30.0),
image: section.imageSource != null || section.type == SectionType.Video ? new DecorationImage(
fit: BoxFit.cover,
colorFilter: !isSelected? new ColorFilter.mode(kBackgroundLight.withOpacity(0.2), BlendMode.dstATop) : null,
image: ImageCustomProvider.getImageProvider(appContext, section.imageId, section.type == SectionType.Video ? getYoutubeThumbnailUrl(section) : section.imageSource!),
colorFilter: !isSelected? new ColorFilter.mode(kBackgroundLight.withValues(alpha: 0.2), BlendMode.dstATop) : null,
image: ImageCustomProvider.getImageProvider(appContext, section.imageId, section.type == SectionType.Video ? getYoutubeThumbnailUrl(rawSectionData) : section.imageSource!),
): null,
boxShadow: [
BoxShadow(
@ -532,7 +524,7 @@ Widget getContent(TabletAppContext tabletAppContext, SectionDTO sectionSelected,
future: getByteIcons(tabletAppContext, mapDTO),
builder: (context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return MapView(section: sectionSelected, icons: snapshot.data);
return MapView(section: mapDTO, icons: snapshot.data);
} else if (snapshot.connectionState == ConnectionState.none) {
return Text("No data");
} else {
@ -580,6 +572,6 @@ Widget getContent(TabletAppContext tabletAppContext, SectionDTO sectionSelected,
WeatherDTO weatherDTO = WeatherDTO.fromJson(rawSectionData)!;
return WeatherView(section: weatherDTO);
default:
return Text("Ce type n'est pas supporté");
return Center(child: Text("Ce type n'est pas supporté"));
};
}

View File

@ -249,7 +249,7 @@ boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 30.0),
image: section.imageSource != null ? new DecorationImage(
fit: BoxFit.cover,
colorFilter: !isSelected? new ColorFilter.mode(kBackgroundLight.withOpacity(0.2), BlendMode.dstATop) : null,
colorFilter: !isSelected? new ColorFilter.mode(kBackgroundLight.withValues(alpha: 0.2), BlendMode.dstATop) : null,
image: ImageCustomProvider.getImageProvider(appContext, section.imageId!, section.imageSource!),
): null,
boxShadow: [

View File

@ -73,7 +73,7 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
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))
for(var pointWithoutCat in geoPoints.where((gp) => gp.categorieId == null))
{
if(pointWithoutCat.title!.where((l) => l.language == widget.language).firstOrNull != null) {
TreeNode nodeWithoutCat = TreeNode(
@ -106,7 +106,7 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
);
// Ajoutez les géopoints correspondant à cette catégorie en tant qu'enfants du nœud parent
for (var geoPoint in geoPoints.where((gp) => gp.categorie != null || gp.categorieId != null)) {
for (var geoPoint in geoPoints.where((gp) => gp.categorieId != null)) {
if (geoPoint.categorieId == category.id && geoPoint.title!.where((l) => l.language == widget.language).firstOrNull != null) {
TreeNode geoPointNode = TreeNode(
id: 000 + int.parse(
@ -255,7 +255,7 @@ class _GeoPointFilterState extends State<GeoPointFilter> {
child: Container(
width: size.width * 0.3,
decoration: BoxDecoration(
color: kBackgroundColor.withOpacity(0.78),
color: kBackgroundColor.withValues(alpha: 0.78),
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0)),
),
child: Padding(

View File

@ -51,7 +51,7 @@ class _GoogleMapViewState extends State<GoogleMapView> {
contents: point.contents
);*/
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,;
var icon = point.categorieId == null ? BitmapDescriptor.bytes(widget.icons.where((i) => i['id'] == null).first['icon']) : widget.icons.any((i) => i['id'] == point.categorieId) ? BitmapDescriptor.bytes(widget.icons.where((i) => i['id'] == point.categorieId).first['icon']) : BitmapDescriptor.bytes(widget.icons.where((i) => i['id'] == null).first['icon']); //widget.selectedMarkerIcon,;
markers.add(Marker(
draggable: false,
markerId: MarkerId(parse(textSansHTML.body!.text).documentElement!.text + point.latitude! + point.longitude!),

View File

@ -86,7 +86,7 @@ class _MapBoxViewState extends State<MapBoxView> {
symbolSortKey: 10,
iconColor: 0,
iconImage: null,
image: point.categorie == null ? widget.icons.where((i) => i['id'] == null).first['icon'] : widget.icons.any((i) => i['id'] == point.categorieId) ? widget.icons.where((i) => i['id'] == point.categorieId).first['icon'] : widget.icons.where((i) => i['id'] == null).first['icon'], //widget.selectedMarkerIcon,
image: point.categorieId == null ? widget.icons.where((i) => i['id'] == null).first['icon'] : widget.icons.any((i) => i['id'] == point.categorieId) ? widget.icons.where((i) => i['id'] == point.categorieId).first['icon'] : widget.icons.where((i) => i['id'] == null).first['icon'], //widget.selectedMarkerIcon,
)); // ,
i++;

View File

@ -274,7 +274,7 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
pageSnapping: true,
reverse: false,
),
items: selectedPoint.contents!.map<Widget>((ContentGeoPoint i) {
items: selectedPoint.contents!.map<Widget>((ContentDTO i) {
return Builder(
builder: (BuildContext context) {
AppContext appContext = Provider.of<AppContext>(context);
@ -568,12 +568,12 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
}
}
getElementForResource(BuildContext context, AppContext appContext, ContentGeoPoint i, bool addFullScreen) {
getElementForResource(BuildContext context, AppContext appContext, ContentDTO i, bool addFullScreen) {
var widgetToInclude;
Size size = MediaQuery.of(context).size;
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
switch(i.resourceType) {
switch(i.resource?.type) {
case ResourceType.Image:
case ResourceType.ImageUrl:
widgetToInclude = GestureDetector(
@ -601,7 +601,7 @@ getElementForResource(BuildContext context, AppContext appContext, ContentGeoPoi
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)),
),
child: PhotoView(
imageProvider: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resourceUrl!),
imageProvider: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resource!.url!),
minScale: PhotoViewComputedScale.contained * 0.8,
maxScale: PhotoViewComputedScale.contained * 3.0,
backgroundDecoration: BoxDecoration(
@ -621,7 +621,7 @@ getElementForResource(BuildContext context, AppContext appContext, ContentGeoPoi
decoration: BoxDecoration(
//color: kBackgroundLight,
image: DecorationImage(
image: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resourceUrl!),
image: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resource!.url!),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)),
@ -639,7 +639,7 @@ getElementForResource(BuildContext context, AppContext appContext, ContentGeoPoi
widgetToInclude = GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
if(addFullScreen && i.resourceType != ResourceType.Audio) {
if(addFullScreen && i.resource!.type != ResourceType.Audio) {
showDialog(
context: context,
builder: (BuildContext context) {
@ -656,7 +656,7 @@ getElementForResource(BuildContext context, AppContext appContext, ContentGeoPoi
),
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: Center(child: showElementForResource(ResourceDTO(id: i.resourceId, url: i.resource?.url, type: i.resource?.type), appContext, false, true)),
),
);
},
@ -664,14 +664,14 @@ getElementForResource(BuildContext context, AppContext appContext, ContentGeoPoi
}
},
child: IgnorePointer(
ignoring: i.resourceType != ResourceType.Audio,
ignoring: i.resource!.type != 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.resource?.url, type: i.resource?.type), appContext, false, true),
),
),
);

View File

@ -1,6 +1,4 @@
import 'dart:convert';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
@ -8,19 +6,9 @@ import 'package:manager_api_new/api.dart';
import 'package:provider/provider.dart';
import 'package:tablet_app/Components/loading_common.dart';
import 'package:tablet_app/Helpers/ImageCustomProvider.dart';
import 'package:tablet_app/Models/map-marker.dart';
import 'package:tablet_app/Models/tabletContext.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/section_page_detail.dart';
import 'package:tablet_app/Screens/Map/map_context.dart';
import 'package:tablet_app/Screens/Map/map_view.dart';
import 'package:tablet_app/Screens/PDF/pdf_view.dart';
import 'package:tablet_app/Screens/Puzzle/puzzle_view.dart';
import 'package:tablet_app/Screens/Quizz/quizz_view.dart';
import 'package:tablet_app/Screens/Slider/slider_view.dart';
import 'package:tablet_app/Screens/Video/video_view.dart';
import 'package:tablet_app/Screens/Web/web_view.dart';
import 'package:tablet_app/app_context.dart';
import 'package:tablet_app/constants.dart';
@ -34,17 +22,21 @@ class MenuView extends StatefulWidget {
}
class _MenuView extends State<MenuView> {
MenuDTO menuDTO = MenuDTO();
//MenuDTO menuDTO = MenuDTO();
SectionDTO? selectedSection;
bool isImageBackground = false;
late List<dynamic> rawSubSectionsData;
late List<SectionDTO> subSections;
@override
void initState() {
/*print(widget.section.data);
menuDTO = MenuDTO.fromJson(jsonDecode(widget.section.data!))!;
print(menuDTO);*/
menuDTO = widget.section;
menuDTO.sections!.sort((a, b) => a.order!.compareTo(b.order!)); // useless, we get these after that
//menuDTO = widget.section;
rawSubSectionsData = jsonDecode(jsonEncode(widget.section.sections));
//menuDTO.sections!.sort((a, b) => a.order!.compareTo(b.order!)); // useless, we get these after that
subSections = jsonDecode(jsonEncode(rawSubSectionsData)).map((json) => SectionDTO.fromJson(json)).whereType<SectionDTO>().toList();
isImageBackground = widget.isImageBackground;
@ -69,11 +61,14 @@ class _MenuView extends State<MenuView> {
child: GridView.builder(
shrinkWrap: true,
gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: kIsWeb ? 1.7 : 1.3),
itemCount: menuDTO.sections!.length,
itemCount: subSections.length,
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: () async {
SectionDTO? section = await (appContext.getContext() as TabletAppContext).clientAPI!.sectionApi!.sectionGetDetail(menuDTO.sections![index].id!);
onTap: () {
//SectionDTO? section = await (appContext.getContext() as TabletAppContext).clientAPI!.sectionApi!.sectionGetDetail(menuDTO.sections![index].id!);
SectionDTO section = subSections[index];
var rawSectionData = rawSubSectionsData[index];
setState(() {
//selectedSection = section;
//selectedSection = menuDTO.sections![index];
@ -81,14 +76,14 @@ class _MenuView extends State<MenuView> {
context,
MaterialPageRoute(
builder: (context) {
return SectionPageDetail(configurationDTO: configurationDTO, sectionDTO: section!, textColor: textColor, isImageBackground: isImageBackground, elementToShow: getContent(tabletAppContext, section, isImageBackground), isFromMenu: true);
return SectionPageDetail(configurationDTO: configurationDTO, sectionDTO: section, textColor: textColor, isImageBackground: isImageBackground, elementToShow: getContent(tabletAppContext, section, isImageBackground, rawSectionData), isFromMenu: true);
},
),// For pushAndRemoveUntil
);
});
},
child: Container(
decoration: isImageBackground ? boxDecoration(appContext, menuDTO.sections![index], false) : null,
decoration: isImageBackground ? boxDecoration(appContext, subSections[index], false, rawSubSectionsData[index]) : null,
padding: const EdgeInsets.all(20),
margin: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
child: isImageBackground ? Align(
@ -100,7 +95,7 @@ class _MenuView extends State<MenuView> {
Align(
alignment: Alignment.centerRight,
child: HtmlWidget(
menuDTO.sections![index].title!.where((translation) => translation.language == appContext.getContext().language).firstOrNull?.value ?? "",
subSections[index].title!.where((translation) => translation.language == appContext.getContext().language).firstOrNull?.value ?? "",
customStylesBuilder: (element) {
return {'text-align': 'right', 'font-family': "Roboto"};
},
@ -126,11 +121,11 @@ class _MenuView extends State<MenuView> {
flex: 7,
child: Container(
decoration: BoxDecoration(
color: menuDTO.sections![index].imageSource == null && menuDTO.sections![index].type != SectionType.Video ? kBackgroundColor : null, // default color if no image
color: subSections[index].imageSource == null && subSections[index].type != SectionType.Video ? kBackgroundColor : null, // default color if no image
shape: BoxShape.rectangle,
image: menuDTO.sections![index].imageSource != null || menuDTO.sections![index].type == SectionType.Video ? new DecorationImage(
image: subSections[index].imageSource != null || subSections[index].type == SectionType.Video ? new DecorationImage(
fit: BoxFit.contain, // contain or cover ?
image: ImageCustomProvider.getImageProvider(appContext, menuDTO.sections![index].imageId, menuDTO.sections![index].type == SectionType.Video ? getYoutubeThumbnailUrl(menuDTO.sections![index]) : menuDTO.sections![index].imageSource!),
image: ImageCustomProvider.getImageProvider(appContext, subSections[index].imageId, subSections[index].type == SectionType.Video ? getYoutubeThumbnailUrl(rawSubSectionsData[index]) : subSections[index].imageSource!),
): null,
),
)
@ -144,7 +139,7 @@ class _MenuView extends State<MenuView> {
),
child: Center(
child: HtmlWidget(
menuDTO.sections![index].title!.where((translation) => translation.language == appContext.getContext().language).firstOrNull?.value ?? "",
subSections[index].title!.where((translation) => translation.language == appContext.getContext().language).firstOrNull?.value ?? "",
customStylesBuilder: (element) {
return {'text-align': 'center', 'font-family': "Roboto"};
},
@ -163,7 +158,7 @@ class _MenuView extends State<MenuView> {
}
}
boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
boxDecoration(AppContext appContext, SectionDTO section, bool isSelected, Object rawSubSectionData) {
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
return BoxDecoration(
@ -172,8 +167,8 @@ boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
borderRadius: BorderRadius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 20.0),
image: section.imageSource != null || section.type == SectionType.Video ? new DecorationImage(
fit: BoxFit.cover,
colorFilter: !isSelected? new ColorFilter.mode(kBackgroundLight.withOpacity(0.35), BlendMode.dstATop) : null,
image: ImageCustomProvider.getImageProvider(appContext, section.imageId, section.type == SectionType.Video ? getYoutubeThumbnailUrl(section) : section.imageSource!),
colorFilter: !isSelected? new ColorFilter.mode(kBackgroundLight.withValues(alpha: 0.35), BlendMode.dstATop) : null,
image: ImageCustomProvider.getImageProvider(appContext, section.imageId, section.type == SectionType.Video ? getYoutubeThumbnailUrl(rawSubSectionData) : section.imageSource!),
): null,
boxShadow: [
BoxShadow(
@ -186,13 +181,18 @@ boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
);
}
String getYoutubeThumbnailUrl(SectionDTO sectionDTO) {
String getYoutubeThumbnailUrl(Object rawSectionData) {
try{
VideoDTO? videoDTO = VideoDTO.fromJson(jsonDecode(sectionDTO.data!));
Uri uri = Uri.parse(videoDTO!.source_!);
VideoDTO videoDTO = VideoDTO.fromJson(rawSectionData)!;
String thumbnailUrl = "";
if(videoDTO.source_ != null) {
//VideoDTO? videoDTO = VideoDTO.fromJson(jsonDecode(sectionDTO.data!));
Uri uri = Uri.parse(videoDTO.source_!);
String videoId = uri.queryParameters['v']!;
// Construire l'URL du thumbnail en utilisant l'identifiant de la vidéo YouTube
String thumbnailUrl = 'https://img.youtube.com/vi/$videoId/0.jpg';
thumbnailUrl = 'https://img.youtube.com/vi/$videoId/0.jpg';
}
return thumbnailUrl;

View File

@ -266,7 +266,7 @@ class _PreviousViewWidget extends State<PreviousViewWidget> with TickerProviderS
child: ChangeNotifierProvider<MapContext>(
create: (_) =>
MapContext(null),
child: MapView(section: SectionDTO(), icons: []) /*FutureBuilder(
child: MapView(section: MapDTO(), icons: []) /*FutureBuilder(
future: _url,
builder: (BuildContext context, AsyncSnapshot snapshot) => snapshot.hasData
? WebViewWidget(url: snapshot.data,)

View File

@ -87,7 +87,7 @@ class _QuizzView extends State<QuizzView> {
goodResponses +=1;
});
log("goodResponses =" + goodResponses.toString());
LevelDTO? levelToShow;
List<TranslationAndResourceDTO>? levelToShow;
var test = goodResponses/quizzDTO.questions!.length;
if(0 == test || test < 0.25)
@ -125,7 +125,7 @@ class _QuizzView extends State<QuizzView> {
),
),
),
if (levelToShow != null && !showResponses && levelToShow.label != null && levelToShow.label!.firstWhere((translation) => translation.language == appContext.getContext().language).resourceId != null)
if (levelToShow != null && !showResponses && levelToShow.firstWhere((translation) => translation.language == appContext.getContext().language).resourceId != null)
Container(
//height: size.height * 0.2,
//width: size.width * 0.25,
@ -134,7 +134,7 @@ class _QuizzView extends State<QuizzView> {
maxWidth: kIsWeb ? size.width * 0.20 : size.width * 0.20, //size.width * 0.25
),
alignment: Alignment.center,
child : getElementForResource(context, appContext, levelToShow.label!.firstWhere((translation) => translation.language == appContext.getContext().language), true),
child : getElementForResource(context, appContext, levelToShow.firstWhere((translation) => translation.language == appContext.getContext().language), true),
),
Container(
height: showResponses ? 60 : 90,
@ -169,7 +169,7 @@ class _QuizzView extends State<QuizzView> {
padding: const EdgeInsets.all(15.0),
child: levelToShow != null ?
HtmlWidget(
levelToShow.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? levelToShow.label!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
levelToShow.firstWhere((translation) => translation.language == appContext.getContext().language).value != null ? levelToShow.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize),
customStylesBuilder: (element) {
return {'text-align': 'center', 'font-family': "Roboto"};
@ -546,7 +546,7 @@ getElementForResource(BuildContext context, AppContext appContext, TranslationAn
Size size = MediaQuery.of(context).size;
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
switch(i.resourceType) {
switch(i.resource!.type) {
case ResourceType.Image:
case ResourceType.ImageUrl:
widgetToInclude = GestureDetector(
@ -574,7 +574,7 @@ getElementForResource(BuildContext context, AppContext appContext, TranslationAn
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)),
),
child: PhotoView(
imageProvider: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resourceUrl!),
imageProvider: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resource!.url!),
minScale: PhotoViewComputedScale.contained * 0.8,
maxScale: PhotoViewComputedScale.contained * 3.0,
backgroundDecoration: BoxDecoration(
@ -594,7 +594,7 @@ getElementForResource(BuildContext context, AppContext appContext, TranslationAn
decoration: BoxDecoration(
//color: kBackgroundLight,
image: DecorationImage(
image: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resourceUrl!),
image: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resource!.url!),
fit: BoxFit.contain,
),
borderRadius: BorderRadius.all(Radius.circular(tabletAppContext.configuration!.roundedValue?.toDouble() ?? 15.0)),
@ -612,7 +612,7 @@ getElementForResource(BuildContext context, AppContext appContext, TranslationAn
widgetToInclude = GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
if(addFullScreen && i.resourceType != ResourceType.Audio) {
if(addFullScreen && i.resource!.type != ResourceType.Audio) {
showDialog(
context: context,
builder: (BuildContext context) {
@ -629,7 +629,7 @@ getElementForResource(BuildContext context, AppContext appContext, TranslationAn
),
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: Center(child: showElementForResource(ResourceDTO(id: i.resourceId, url: i.resource!.url, type: i.resource!.type), appContext, false, true)),
),
);
},
@ -637,14 +637,14 @@ getElementForResource(BuildContext context, AppContext appContext, TranslationAn
}
},
child: IgnorePointer(
ignoring: i.resourceType != ResourceType.Audio,
ignoring: i.resource!.type != ResourceType.Audio,
child: Container(
decoration: BoxDecoration(
//color: kBackgroundSecondGrey,
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.resource!.url, type: i.resource!.type), appContext, false, true),
),
),
);

View File

@ -255,7 +255,7 @@ class _WeatherViewState extends State<WeatherView> {
color: Colors.lightBlueAccent,
boxShadow: [
BoxShadow(
color: kBackgroundGrey.withOpacity(0.6),
color: kBackgroundGrey.withValues(alpha: 0.6),
spreadRadius: 0.75,
blurRadius: 3.1,
offset: Offset(0, 2.5), // changes position of shadow
@ -312,7 +312,7 @@ class _WeatherViewState extends State<WeatherView> {
color: Colors.lightBlue,
boxShadow: [
BoxShadow(
color: kBackgroundGrey.withOpacity(0.5),
color: kBackgroundGrey.withValues(alpha: 0.5),
spreadRadius: 0.75,
blurRadius: 3.1,
offset: Offset(0, 2.5), // changes position of shadow

View File

@ -94,7 +94,7 @@ class MenuDTO {
int? beaconId;
List<SectionDTO>? sections;
dynamic? sections;
@override
bool operator ==(Object other) =>
@ -286,7 +286,7 @@ class MenuDTO {
meterZoneGPS: mapValueOfType<int>(json, r'meterZoneGPS'),
isBeacon: mapValueOfType<bool>(json, r'isBeacon'),
beaconId: mapValueOfType<int>(json, r'beaconId'),
sections: SectionDTO.listFromJson(json[r'sections']),
sections: json[r'sections'],
);
}
return null;