Premier vrai build depuis avril. Le diagnostic des docs — « un seul défaut, purement Gradle, peut-être réglé par 5a6701d » — tenait parce que personne n'avait lancé la commande. K1 — dix crans d'outillage, chacun dicté par l'erreur du précédent : Gradle 7.5 → 8.11.1, AGP 7.2.0 → 8.9.1, Kotlin 1.9.0 → 2.3.10, enableUncompressedNativeLibs retirée (supprimée en AGP 8.1), jcenter → mavenCentral, heap 1536M → 4096M, Jetifier coupé, et retrait du resolutionStrategy qui forçait androidx.lifecycle à 2.4.0 « to fix mapbox issue » : il réglait un problème d'il y a trois ans et causait celui d'aujourd'hui, mapbox_maps_flutter 2.21.1 appelant setViewTreeLifecycleOwner. Les trois derniers crans étaient de simples alignements sur mymuseum-visitapp, qui utilise le même plugin sans ces problèmes. Le bloc buildscript commenté de android/build.gradle est supprimé : il déclarait une config qui n'était pas celle appliquée et a fait conclure deux fois à tort. K2 — les 132 erreurs Dart que le Gradle masquait. Trois causes : roundedValue, isDate, isHour, isSectionImageBackground et screenPercentageSectionsMainPage ont migré vers AppConfigurationLink ; GeoPointDTO.latitude/longitude sont devenus geometry ; le reste en découlait. Deux bugs latents trouvés au passage : - applicationInstanceDTO n'était assigné que si l'instance avait l'IA — il servait de drapeau d'assistant. Ce DTO portant désormais les AppConfigurationLink, les cinq réglages seraient retombés sur leurs défauts sur MDLF et le Fort, sans erreur ni log. Drapeau rendu explicite, en préservant le ET instance × canal. - ConfigurationDTO.isTablet ayant disparu, le filtre des configurations tablette n'avait plus de source : il porte sur les liens du canal AppType.Tablet. La formule de clé par coordonnées de geo_point_filter, dupliquée à quatre endroits alors que les deux côtés de l'appariement doivent produire la même valeur, ne vit plus qu'à un seul (Helpers/geo.dart). Ce fichier documente aussi les deux conventions de coordonnées du projet : [lng, lat] pour les GeoPoint, [lat, lng] pour les géométries de GuidedStep. K4 — l'écran Game repris de mymuseum-visitapp, Screens/Puzzle supprimé. La tablette gagne le puzzle glissant, le bouton d'indice et un dimensionnement au ratio de l'image. Les couleurs, codées en dur par flavor client chez mymuseum, sont dérivées de configuration.primaryColor : tablet-app n'a pas de flavor, un seul APK sert tous les clients. Reste à vérifier sur device : le rendu de l'écran Game, et l'écran de sélection de configuration, qui sera vide si les configurations ne sont pas rattachées au canal tablette. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
311 lines
14 KiB
Dart
311 lines
14 KiB
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/gestures.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
|
import 'package:manager_api_new/api.dart';
|
|
import 'package:path_provider/path_provider.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:tablet_app/Components/Carousel/carousel_slider.dart' as cs;
|
|
import 'package:tablet_app/Components/show_element_for_resource.dart';
|
|
import 'package:tablet_app/Components/video_viewer.dart';
|
|
import 'package:tablet_app/Helpers/ImageCustomProvider.dart';
|
|
import 'package:tablet_app/Models/tabletContext.dart';
|
|
import 'package:tablet_app/app_context.dart';
|
|
import 'package:tablet_app/constants.dart';
|
|
import 'package:photo_view/photo_view.dart';
|
|
|
|
class SliderView extends StatefulWidget {
|
|
final SliderDTO section;
|
|
SliderView({required this.section});
|
|
|
|
@override
|
|
_SliderView createState() => _SliderView();
|
|
}
|
|
|
|
class _SliderView extends State<SliderView> {
|
|
SliderDTO sliderDTO = SliderDTO();
|
|
cs.CarouselController? sliderController;
|
|
ValueNotifier<int> currentIndex = ValueNotifier<int>(1);
|
|
|
|
late ConfigurationDTO configurationDTO;
|
|
|
|
@override
|
|
void initState() {
|
|
sliderController = cs.CarouselController();
|
|
//sliderDTO = SliderDTO.fromJson(jsonDecode(widget.section!.data!))!;
|
|
sliderDTO = widget.section;
|
|
sliderDTO.contents!.sort((a, b) => a.order!.compareTo(b.order!));
|
|
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
sliderController = null;
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Size size = MediaQuery.of(context).size;
|
|
final appContext = Provider.of<AppContext>(context);
|
|
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
|
Color? primaryColor = tabletAppContext.configuration!.primaryColor != null ? new Color(int.parse(tabletAppContext.configuration!.primaryColor!.split('(0x')[1].split(')')[0], radix: 16)) : null;
|
|
|
|
configurationDTO = appContext.getContext().configuration;
|
|
|
|
return Stack(
|
|
children: [
|
|
if(sliderDTO.contents != null && sliderDTO.contents!.length > 0)
|
|
cs.CarouselSlider(
|
|
carouselController: sliderController,
|
|
options: cs.CarouselOptions(
|
|
onPageChanged: (int index, cs.CarouselPageChangedReason reason) {
|
|
currentIndex.value = index + 1;
|
|
},
|
|
height: MediaQuery.of(context).size.height * 0.8,
|
|
enlargeCenterPage: true,
|
|
reverse: false,
|
|
),
|
|
items: sliderDTO.contents!.map<Widget>((i) {
|
|
return Builder(
|
|
builder: (BuildContext context) {
|
|
return Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
height: MediaQuery.of(context).size.height,
|
|
margin: EdgeInsets.symmetric(horizontal: 5.0),
|
|
decoration: BoxDecoration(
|
|
//color: configurationDTO.imageId == null ? configurationDTO.secondaryColor != null ? new Color(int.parse(configurationDTO.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null,
|
|
borderRadius: BorderRadius.circular(tabletAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 10.0),
|
|
//border: Border.all(width: 0.3, color: kSecondGrey),
|
|
),
|
|
child: Column(
|
|
//crossAxisAlignment: CrossAxisAlignment.center,
|
|
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: Container(
|
|
height: MediaQuery.of(context).size.height * 0.6,
|
|
width: MediaQuery.of(context).size.width * 0.72,
|
|
/*decoration: BoxDecoration(
|
|
color: kBackgroundLight,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(20.0),
|
|
/*image: i.source_ != null ? new DecorationImage(
|
|
fit: BoxFit.cover,
|
|
image: new NetworkImage(
|
|
i.source_,
|
|
),
|
|
): null,*/
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: kBackgroundSecondGrey,
|
|
spreadRadius: 0.5,
|
|
blurRadius: 5,
|
|
offset: Offset(0, 1.5), // changes position of shadow
|
|
),
|
|
],
|
|
),*/
|
|
child: Stack(
|
|
children: [
|
|
getElementForResource(appContext, i),
|
|
Positioned(
|
|
bottom: 0,
|
|
right: 0,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(15.0),
|
|
child: HtmlWidget(
|
|
i.title!.where((translation) => translation.language == appContext.getContext().language).firstOrNull?.value != null ? i.title!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
|
|
textStyle: TextStyle(fontSize: kIsWeb ? kWebTitleSize : kTitleSize, color: kBackgroundLight),
|
|
),
|
|
)
|
|
)
|
|
]
|
|
),/**/
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: const EdgeInsets.only(bottom: 10),
|
|
child: Container(
|
|
height: MediaQuery.of(context).size.height *0.25,
|
|
width: MediaQuery.of(context).size.width *0.7,
|
|
decoration: BoxDecoration(
|
|
color: kBackgroundLight,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(tabletAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 10.0),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: kBackgroundSecondGrey,
|
|
spreadRadius: 0.3,
|
|
blurRadius: 4,
|
|
offset: Offset(0, 2), // changes position of shadow
|
|
),
|
|
],
|
|
),
|
|
child: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(15.0),
|
|
child: HtmlWidget(
|
|
i.description!.where((translation) => translation.language == appContext.getContext().language).firstOrNull?.value != null ? i.description!.firstWhere((translation) => translation.language == appContext.getContext().language).value! : "",
|
|
textStyle: TextStyle(fontSize: kIsWeb ? kWebDescriptionSize : kDescriptionSize),
|
|
customStylesBuilder: (element) {
|
|
return {'text-align': 'center', 'font-family': "Roboto"};
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
);
|
|
},
|
|
);
|
|
}).toList(),
|
|
),
|
|
if(sliderDTO.contents != null && sliderDTO.contents!.length > 1)
|
|
Positioned(
|
|
top: MediaQuery.of(context).size.height * 0.35,
|
|
right: 60,
|
|
child: InkWell(
|
|
onTap: () {
|
|
if (sliderDTO.contents!.length > 0)
|
|
sliderController!.nextPage(duration: new Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
|
|
},
|
|
child: Icon(
|
|
Icons.chevron_right,
|
|
size: 90,
|
|
color: primaryColor ?? kTestSecondColor,
|
|
),
|
|
)
|
|
),
|
|
if(sliderDTO.contents != null && sliderDTO.contents!.length > 1)
|
|
Positioned(
|
|
top: MediaQuery.of(context).size.height * 0.35,
|
|
left: 60,
|
|
child: InkWell(
|
|
onTap: () {
|
|
if (sliderDTO.contents!.length > 0)
|
|
sliderController!.previousPage(duration: new Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
|
|
},
|
|
child: Icon(
|
|
Icons.chevron_left,
|
|
size: 90,
|
|
color: primaryColor ?? kTestSecondColor,
|
|
),
|
|
)
|
|
),
|
|
if(sliderDTO.contents != null && sliderDTO.contents!.length > 0)
|
|
Padding(
|
|
padding: widget.section!.parentId == null ? EdgeInsets.only() : const EdgeInsets.only(left: 15, bottom: 10),
|
|
child: Align(
|
|
alignment: widget.section!.parentId == null ? Alignment.bottomCenter : Alignment.bottomLeft,
|
|
child: InkWell(
|
|
onTap: () {
|
|
sliderController!.previousPage(duration: new Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
|
|
},
|
|
child: ValueListenableBuilder<int>(
|
|
valueListenable: currentIndex,
|
|
builder: (context, value, _) {
|
|
return Text(
|
|
value.toString()+'/'+sliderDTO.contents!.length.toString(),
|
|
style: TextStyle(fontSize: 25, fontWeight: FontWeight.w500),
|
|
);
|
|
}
|
|
),
|
|
)
|
|
),
|
|
),
|
|
if(sliderDTO.contents == null || sliderDTO.contents!.length == 0)
|
|
Center(child: Text("Aucun contenu à afficher", style: TextStyle(fontSize: kNoneInfoOrIncorrect)))
|
|
// Description
|
|
/*Container(
|
|
height: sliderDTO.images != null && sliderDTO.images.length > 0 ? size.height *0.3 : size.height *0.6,
|
|
width: MediaQuery.of(context).size.width *0.35,
|
|
decoration: BoxDecoration(
|
|
color: kBackgroundLight,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(10.0),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: kBackgroundSecondGrey,
|
|
spreadRadius: 0.5,
|
|
blurRadius: 1.1,
|
|
offset: Offset(0, 1.1), // changes position of shadow
|
|
),
|
|
],
|
|
),
|
|
child: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(15.0),
|
|
child: Text(sliderDTO., textAlign: TextAlign.center, style: TextStyle(fontSize: 15)),
|
|
),
|
|
),
|
|
),*/
|
|
]
|
|
);
|
|
}
|
|
|
|
getElementForResource(AppContext appContext, ContentDTO i) {
|
|
var widgetToInclude;
|
|
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
|
|
|
switch(i.resource!.type) {
|
|
case ResourceType.Image:
|
|
widgetToInclude = PhotoView(
|
|
imageProvider: ImageCustomProvider.getImageProvider(appContext, i.resourceId!, i.resource!.url!),
|
|
minScale: PhotoViewComputedScale.contained * 0.8,
|
|
maxScale: PhotoViewComputedScale.contained * 3.0,
|
|
backgroundDecoration: BoxDecoration(
|
|
color: kBackgroundSecondGrey,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(tabletAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0),
|
|
),
|
|
);
|
|
break;
|
|
case ResourceType.ImageUrl:
|
|
widgetToInclude = PhotoView(
|
|
imageProvider: CachedNetworkImageProvider(i.resource!.url!),
|
|
minScale: PhotoViewComputedScale.contained * 0.8,
|
|
maxScale: PhotoViewComputedScale.contained * 3.0,
|
|
backgroundDecoration: BoxDecoration(
|
|
color: kBackgroundSecondGrey,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(tabletAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0),
|
|
),
|
|
);
|
|
break;
|
|
case ResourceType.Video:
|
|
case ResourceType.VideoUrl:
|
|
case ResourceType.Audio:
|
|
widgetToInclude = Container(
|
|
decoration: BoxDecoration(
|
|
//color: kBackgroundSecondGrey,
|
|
//shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(tabletAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 15.0),
|
|
),
|
|
child: showElementForResource(ResourceDTO(id: i.resourceId, url: i.resource!.url, type: i.resource!.type), appContext, false, true),
|
|
);
|
|
break;
|
|
}
|
|
|
|
return Center(
|
|
child: Container(
|
|
height: MediaQuery.of(context).size.height * 0.6,
|
|
width: MediaQuery.of(context).size.width * 0.72,
|
|
child: AspectRatio(
|
|
aspectRatio: 16 / 9,
|
|
child: ClipRect(
|
|
child: widgetToInclude,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |