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>
286 lines
14 KiB
Dart
286 lines
14 KiB
Dart
import 'dart:async';
|
|
import 'dart:typed_data';
|
|
import 'package:enum_to_string/enum_to_string.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
|
import 'package:manager_api_new/api.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:tablet_app/Components/loading_common.dart';
|
|
import 'package:tablet_app/Components/multi_select_container.dart';
|
|
import 'package:tablet_app/Helpers/ImageCustomProvider.dart';
|
|
import 'package:tablet_app/Helpers/translationHelper.dart';
|
|
import 'package:tablet_app/Models/map-marker.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/map_context.dart';
|
|
import 'package:html/parser.dart' show parse;
|
|
import 'package:tablet_app/Screens/Menu/menu_view.dart';
|
|
import 'package:tablet_app/Services/statisticsService.dart';
|
|
import 'package:tablet_app/app_context.dart';
|
|
import 'package:tablet_app/constants.dart';
|
|
|
|
class SectionPageDetail extends StatefulWidget {
|
|
final ConfigurationDTO configurationDTO;
|
|
final SectionDTO sectionDTO;
|
|
final Uint8List? selectedMarkerIcon;
|
|
final Color textColor;
|
|
final bool isImageBackground;
|
|
final bool isFromMenu;
|
|
final Widget elementToShow;
|
|
const SectionPageDetail({
|
|
Key? key,
|
|
required this.configurationDTO,
|
|
required this.sectionDTO,
|
|
this.selectedMarkerIcon,
|
|
required this.textColor,
|
|
required this.isImageBackground,
|
|
required this.isFromMenu,
|
|
required this.elementToShow,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
_SectionPageDetailState createState() => _SectionPageDetailState();
|
|
}
|
|
|
|
class _SectionPageDetailState extends State<SectionPageDetail> {
|
|
bool init = false;
|
|
DateTime? _sectionOpenTime;
|
|
StatisticsService? _statisticsService;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_sectionOpenTime = DateTime.now();
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
final tabletAppContext = Provider.of<AppContext>(context, listen: false).getContext() as TabletAppContext;
|
|
_statisticsService = tabletAppContext.statisticsService;
|
|
_statisticsService?.track(
|
|
VisitEventType.sectionView,
|
|
sectionId: widget.sectionDTO.id,
|
|
);
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
final duration = _sectionOpenTime != null
|
|
? DateTime.now().difference(_sectionOpenTime!).inSeconds
|
|
: null;
|
|
_statisticsService?.track(
|
|
VisitEventType.sectionLeave,
|
|
sectionId: widget.sectionDTO.id,
|
|
durationSeconds: duration,
|
|
);
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final appContext = Provider.of<AppContext>(context);
|
|
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
|
Size size = MediaQuery.of(context).size;
|
|
|
|
return Scaffold(
|
|
resizeToAvoidBottomInset: false,
|
|
body: SingleChildScrollView(
|
|
child: Container(
|
|
height: size.height,
|
|
width: size.width,
|
|
/*color: widget.configurationDTO.imageId == null ? widget.configurationDTO.secondaryColor != null ? new Color(int.parse(widget.configurationDTO.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : null,
|
|
decoration: widget.configurationDTO.imageId != null ? BoxDecoration(
|
|
image: new DecorationImage(
|
|
fit: BoxFit.cover,
|
|
colorFilter: new ColorFilter.mode(Colors.white.withOpacity(0.8), BlendMode.lighten),
|
|
image: ImageCustomProvider.getImageProvider(appContext, widget.configurationDTO.imageId!, widget.configurationDTO.imageSource!),
|
|
),
|
|
) : null,*/
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Container(
|
|
decoration : BoxDecoration(
|
|
color: kBackgroundLight,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(tabletAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 30.0),
|
|
boxShadow: [
|
|
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: [
|
|
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: widget.isImageBackground ? Container(
|
|
/*width: 125,
|
|
height: 125,*/
|
|
decoration: boxDecoration(appContext, widget.sectionDTO, true),
|
|
) : Container(
|
|
decoration: BoxDecoration(
|
|
color: widget.sectionDTO.imageSource == null && widget.sectionDTO.type != SectionType.Video ? kBackgroundLight : null, // default color if no image
|
|
shape: BoxShape.rectangle,
|
|
image: widget.sectionDTO.imageSource != null || widget.sectionDTO.type == SectionType.Video ? new DecorationImage(
|
|
fit: widget.sectionDTO.type == SectionType.Video && widget.sectionDTO.imageId == null ? BoxFit.contain : BoxFit.cover,
|
|
image: ImageCustomProvider.getImageProvider(appContext, widget.sectionDTO.imageId, widget.sectionDTO.type == SectionType.Video ? getYoutubeThumbnailUrl(widget.sectionDTO) : widget.sectionDTO.imageSource!),
|
|
): null,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
//width: size.width,
|
|
//color: Colors.green,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.center,
|
|
child: HtmlWidget(
|
|
widget.sectionDTO.title!.where((translation) => translation.language == appContext.getContext().language).firstOrNull?.value ?? "",
|
|
textStyle: new TextStyle(fontSize: kIsWeb ? kWebSectionTitleDetailSize : kSectionTitleDetailSize, /*color: widget.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,
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(tabletAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 30.0)),
|
|
onPressed: () {
|
|
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),
|
|
label: Text(TranslationHelper.getFromLocale(widget.isFromMenu ? "back" : "menu", appContext.getContext()), style: TextStyle(color: Colors.black))
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 9,
|
|
child: Padding(
|
|
padding: widget.sectionDTO.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.currentAppConfigurationLink?.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(
|
|
padding: const EdgeInsets.only(bottom: 8.0),
|
|
child: widget.elementToShow),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
/*floatingActionButtonLocation: FloatingActionButtonLocation.endTop,
|
|
floatingActionButton: Padding(
|
|
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))
|
|
),
|
|
),
|
|
),
|
|
),*/
|
|
);
|
|
}
|
|
}
|
|
|
|
boxDecoration(AppContext appContext, SectionDTO section, bool isSelected) {
|
|
TabletAppContext tabletAppContext = appContext.getContext() as TabletAppContext;
|
|
return BoxDecoration(
|
|
color: !isSelected ? kBackgroundLight : section.imageSource == null ? kBackgroundLight : null,
|
|
shape: BoxShape.rectangle,
|
|
borderRadius: BorderRadius.circular(tabletAppContext.currentAppConfigurationLink?.roundedValue?.toDouble() ?? 30.0),
|
|
image: section.imageSource != null ? new DecorationImage(
|
|
fit: BoxFit.cover,
|
|
colorFilter: !isSelected? new ColorFilter.mode(kBackgroundLight.withValues(alpha: 0.2), BlendMode.dstATop) : null,
|
|
image: ImageCustomProvider.getImageProvider(appContext, section.imageId!, section.imageSource!),
|
|
): null,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: kBackgroundSecondGrey,
|
|
spreadRadius: 0.5,
|
|
blurRadius: 5,
|
|
offset: Offset(0, 1.5), // changes position of shadow
|
|
),
|
|
],
|
|
);
|
|
} |