mirror of
https://bitbucket.org/FransoletThomas/tablet-app.git
synced 2025-12-06 08:31:19 +00:00
All in cache (normally.. hum) + fix puzzle layout issue
This commit is contained in:
parent
4e6c281b84
commit
5f425eb65a
@ -53,7 +53,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId "be.unov.mymuseum.tablet_app"
|
applicationId "be.unov.mymuseum.tablet_app"
|
||||||
minSdkVersion 20
|
minSdkVersion 21
|
||||||
targetSdkVersion 34
|
targetSdkVersion 34
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import 'package:just_audio/just_audio.dart';
|
import 'package:just_audio/just_audio.dart';
|
||||||
|
import 'package:just_audio_cache/just_audio_cache.dart';
|
||||||
import 'package:tablet_app/Models/tabletContext.dart';
|
import 'package:tablet_app/Models/tabletContext.dart';
|
||||||
import 'package:tablet_app/app_context.dart';
|
import 'package:tablet_app/app_context.dart';
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ class _AudioPlayerFloatingContainerState extends State<AudioPlayerFloatingContai
|
|||||||
});
|
});
|
||||||
});*/
|
});*/
|
||||||
|
|
||||||
await player.setUrl(widget.resourceURl);
|
await player.dynamicSet(url: widget.resourceURl);
|
||||||
if(widget.isAuto) {
|
if(widget.isAuto) {
|
||||||
//player.play(BytesSource(audiobytes));
|
//player.play(BytesSource(audiobytes));
|
||||||
//await player.setAudioSource(LoadedSource(audiobytes));
|
//await player.setAudioSource(LoadedSource(audiobytes));
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:tablet_app/Models/tabletContext.dart';
|
import 'package:tablet_app/Models/tabletContext.dart';
|
||||||
@ -44,13 +45,21 @@ class _LoadingCommonState extends State<LoadingCommon> with TickerProviderStateM
|
|||||||
_controller!.forward();
|
_controller!.forward();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var primaryColor = tabletAppContext.configuration != null ? tabletAppContext.configuration!.primaryColor != null ? new Color(int.parse(tabletAppContext.configuration!.primaryColor!.split('(0x')[1].split(')')[0], radix: 16)) : kTestSecondColor : kTestSecondColor;
|
||||||
return Center(
|
return Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: size.height * 0.1,
|
height: size.height * 0.1,
|
||||||
child: RotationTransition(
|
child: RotationTransition(
|
||||||
turns: Tween(begin: 0.0, end: 3.0).animate(_controller!),
|
turns: Tween(begin: 0.0, end: 3.0).animate(_controller!),
|
||||||
child: tabletAppContext.configuration != null && tabletAppContext.configuration!.loaderImageUrl != null ?
|
child: tabletAppContext.configuration != null && tabletAppContext.configuration!.loaderImageUrl != null ?
|
||||||
Image.network(tabletAppContext.configuration!.loaderImageUrl!)
|
//Image.network(tabletAppContext.configuration!.loaderImageUrl!)
|
||||||
|
CachedNetworkImage(
|
||||||
|
imageUrl: tabletAppContext.configuration!.loaderImageUrl!,
|
||||||
|
progressIndicatorBuilder: (context, url, downloadProgress) =>
|
||||||
|
CircularProgressIndicator(value: downloadProgress.progress, color: primaryColor),
|
||||||
|
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||||
|
)
|
||||||
: Icon(Icons.museum_outlined, color: kTestSecondColor, size: size.height*0.1),
|
: Icon(Icons.museum_outlined, color: kTestSecondColor, size: size.height*0.1),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:manager_api/api.dart';
|
import 'package:manager_api/api.dart';
|
||||||
@ -16,28 +17,15 @@ showElementForResource(ResourceDTO resourceDTO, AppContext appContext, bool isAu
|
|||||||
|
|
||||||
switch(resourceDTO.type) {
|
switch(resourceDTO.type) {
|
||||||
case ResourceType.Image:
|
case ResourceType.Image:
|
||||||
return Image.network(
|
|
||||||
resourceDTO.url!,
|
|
||||||
fit:BoxFit.fill,
|
|
||||||
loadingBuilder: (BuildContext context, Widget child,
|
|
||||||
ImageChunkEvent? loadingProgress) {
|
|
||||||
if (loadingProgress == null) {
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
return Center(
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
color: primaryColor,
|
|
||||||
value: loadingProgress.expectedTotalBytes != null
|
|
||||||
? loadingProgress.cumulativeBytesLoaded /
|
|
||||||
loadingProgress.expectedTotalBytes!
|
|
||||||
: null,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
case ResourceType.ImageUrl:
|
case ResourceType.ImageUrl:
|
||||||
return Image.network(
|
return CachedNetworkImage(
|
||||||
|
imageUrl: resourceDTO.url!,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
progressIndicatorBuilder: (context, url, downloadProgress) =>
|
||||||
|
CircularProgressIndicator(value: downloadProgress.progress, color: primaryColor),
|
||||||
|
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||||
|
);
|
||||||
|
/*return Image.network(
|
||||||
resourceDTO.url!,
|
resourceDTO.url!,
|
||||||
fit:BoxFit.fill,
|
fit:BoxFit.fill,
|
||||||
loadingBuilder: (BuildContext context, Widget child,
|
loadingBuilder: (BuildContext context, Widget child,
|
||||||
@ -55,7 +43,7 @@ showElementForResource(ResourceDTO resourceDTO, AppContext appContext, bool isAu
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);*/
|
||||||
case ResourceType.Audio:
|
case ResourceType.Audio:
|
||||||
return AudioPlayerFloatingContainer(audioBytes: null, resourceURl: resourceDTO.url!, isAuto: isAuto);
|
return AudioPlayerFloatingContainer(audioBytes: null, resourceURl: resourceDTO.url!, isAuto: isAuto);
|
||||||
/*return FutureBuilder(
|
/*return FutureBuilder(
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
|
import 'package:cached_video_player/cached_video_player.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:tablet_app/Components/loading_common.dart';
|
import 'package:tablet_app/Components/loading_common.dart';
|
||||||
import 'package:video_player/video_player.dart';
|
//import 'package:video_player/video_player.dart';
|
||||||
import '../../constants.dart';
|
import '../../constants.dart';
|
||||||
|
|
||||||
class VideoViewer extends StatefulWidget {
|
class VideoViewer extends StatefulWidget {
|
||||||
@ -12,13 +13,12 @@ class VideoViewer extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _VideoViewer extends State<VideoViewer> {
|
class _VideoViewer extends State<VideoViewer> {
|
||||||
late VideoPlayerController _controller;
|
late CachedVideoPlayerController _controller;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_controller = VideoPlayerController.networkUrl(Uri.parse(
|
_controller = CachedVideoPlayerController.network(widget.videoUrl) // Uri.parse()
|
||||||
widget.videoUrl))
|
|
||||||
..initialize().then((_) {
|
..initialize().then((_) {
|
||||||
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
|
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
|
||||||
setState(() {});
|
setState(() {});
|
||||||
@ -51,7 +51,7 @@ class _VideoViewer extends State<VideoViewer> {
|
|||||||
child: _controller.value.isInitialized
|
child: _controller.value.isInitialized
|
||||||
? AspectRatio(
|
? AspectRatio(
|
||||||
aspectRatio: _controller.value.aspectRatio,
|
aspectRatio: _controller.value.aspectRatio,
|
||||||
child: VideoPlayer(_controller),
|
child: CachedVideoPlayer(_controller),
|
||||||
)
|
)
|
||||||
: Center(
|
: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
|
|||||||
@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:manager_api/api.dart';
|
import 'package:manager_api/api.dart';
|
||||||
import 'package:tablet_app/constants.dart';
|
import 'package:tablet_app/constants.dart';
|
||||||
import 'package:youtube_player_iframe/youtube_player_iframe.dart' as iframe;
|
import 'package:youtube_player_iframe/youtube_player_iframe.dart' as iframe;
|
||||||
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
|
//import 'package:youtube_player_flutter/youtube_player_flutter.dart';
|
||||||
|
|
||||||
class VideoViewerYoutube extends StatefulWidget {
|
class VideoViewerYoutube extends StatefulWidget {
|
||||||
final String videoUrl;
|
final String videoUrl;
|
||||||
@ -19,13 +19,13 @@ class VideoViewerYoutube extends StatefulWidget {
|
|||||||
|
|
||||||
class _VideoViewerYoutube extends State<VideoViewerYoutube> {
|
class _VideoViewerYoutube extends State<VideoViewerYoutube> {
|
||||||
iframe.YoutubePlayer? _videoViewWeb;
|
iframe.YoutubePlayer? _videoViewWeb;
|
||||||
YoutubePlayer? _videoView;
|
//YoutubePlayer? _videoView;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
String? videoId;
|
String? videoId;
|
||||||
if (widget.videoUrl.length > 0 ) {
|
if (widget.videoUrl.length > 0 ) {
|
||||||
videoId = YoutubePlayer.convertUrlToId(widget.videoUrl);
|
//videoId = YoutubePlayer.convertUrlToId(widget.videoUrl);
|
||||||
|
|
||||||
if (widget.webView) {
|
if (widget.webView) {
|
||||||
final _controllerWeb = iframe.YoutubePlayerController(
|
final _controllerWeb = iframe.YoutubePlayerController(
|
||||||
@ -53,7 +53,7 @@ class _VideoViewerYoutube extends State<VideoViewerYoutube> {
|
|||||||
handleColor: Colors.amberAccent,
|
handleColor: Colors.amberAccent,
|
||||||
),*/
|
),*/
|
||||||
);
|
);
|
||||||
} else {
|
} else /*{
|
||||||
// Cause memory issue on tablet
|
// Cause memory issue on tablet
|
||||||
videoId = YoutubePlayer.convertUrlToId(widget.videoUrl);
|
videoId = YoutubePlayer.convertUrlToId(widget.videoUrl);
|
||||||
YoutubePlayerController _controller = YoutubePlayerController(
|
YoutubePlayerController _controller = YoutubePlayerController(
|
||||||
@ -77,7 +77,7 @@ class _VideoViewerYoutube extends State<VideoViewerYoutube> {
|
|||||||
handleColor: Colors.amberAccent,
|
handleColor: Colors.amberAccent,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}*/
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,6 +91,6 @@ class _VideoViewerYoutube extends State<VideoViewerYoutube> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => widget.videoUrl.length > 0 ?
|
Widget build(BuildContext context) => widget.videoUrl.length > 0 ?
|
||||||
(widget.webView ? _videoViewWeb! : _videoView!):
|
_videoViewWeb!: //(widget.webView ? _videoViewWeb! : _videoView!)
|
||||||
Center(child: Text("La vidéo ne peut pas être affichée, l'url est incorrecte", style: new TextStyle(fontSize: kNoneInfoOrIncorrect)));
|
Center(child: Text("La vidéo ne peut pas être affichée, l'url est incorrecte", style: new TextStyle(fontSize: kNoneInfoOrIncorrect)));
|
||||||
}
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:device_info/device_info.dart';
|
import 'package:device_info/device_info.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -358,9 +359,9 @@ boxDecoration(SectionDTO section) {
|
|||||||
image: new DecorationImage(
|
image: new DecorationImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.5), BlendMode.dstATop),
|
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.5), BlendMode.dstATop),
|
||||||
image: new NetworkImage(
|
image: CachedNetworkImageProvider(section.imageSource!), /*new NetworkImage(
|
||||||
section.imageSource!,
|
section.imageSource!,
|
||||||
),
|
),*/
|
||||||
),
|
),
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
@ -139,9 +140,9 @@ class _MainViewWidget extends State<MainViewWidget> {
|
|||||||
image: new DecorationImage(
|
image: new DecorationImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
colorFilter: new ColorFilter.mode(Colors.white.withOpacity(0.8), BlendMode.lighten),
|
colorFilter: new ColorFilter.mode(Colors.white.withOpacity(0.8), BlendMode.lighten),
|
||||||
image: new NetworkImage(
|
image: CachedNetworkImageProvider(configurationDTO.imageSource!),/*new NetworkImage(
|
||||||
configurationDTO.imageSource!,
|
configurationDTO.imageSource!,
|
||||||
),
|
),*/
|
||||||
),
|
),
|
||||||
) : null,
|
) : null,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -256,9 +257,9 @@ class _MainViewWidget extends State<MainViewWidget> {
|
|||||||
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.grey.withOpacity(0.1), BlendMode.color),
|
||||||
image: new NetworkImage(
|
image: CachedNetworkImageProvider(configurationDTO.imageSource!),/*new NetworkImage(
|
||||||
configurationDTO.imageSource!,
|
configurationDTO.imageSource!,
|
||||||
),
|
),*/
|
||||||
),
|
),
|
||||||
) : null,
|
) : null,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
@ -505,9 +506,9 @@ boxDecoration(SectionDTO section, bool isSelected) {
|
|||||||
image: section.imageSource != null ? new DecorationImage(
|
image: section.imageSource != null ? new DecorationImage(
|
||||||
fit: !isSelected || kIsWeb ? BoxFit.cover : BoxFit.contain,
|
fit: !isSelected || kIsWeb ? BoxFit.cover : BoxFit.contain,
|
||||||
colorFilter: !isSelected? new ColorFilter.mode(Colors.black.withOpacity(kIsWeb ? 0.3 : 0.3), BlendMode.dstATop) : null,
|
colorFilter: !isSelected? new ColorFilter.mode(Colors.black.withOpacity(kIsWeb ? 0.3 : 0.3), BlendMode.dstATop) : null,
|
||||||
image: new NetworkImage(
|
image: CachedNetworkImageProvider(section.imageSource!),/*new NetworkImage(
|
||||||
section.imageSource!,
|
section.imageSource!,
|
||||||
),
|
),*/
|
||||||
): null,
|
): null,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
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/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -161,9 +162,9 @@ class _MarkerInfoWidget extends State<MarkerViewWidget> {
|
|||||||
aspectRatio: 16 / 9,
|
aspectRatio: 16 / 9,
|
||||||
child: ClipRect(
|
child: ClipRect(
|
||||||
child: i.imageSource != null ? PhotoView(
|
child: i.imageSource != null ? PhotoView(
|
||||||
imageProvider: new NetworkImage(
|
imageProvider: CachedNetworkImageProvider(i.imageSource), /*new NetworkImage(
|
||||||
i.imageSource,
|
i.imageSource,
|
||||||
),
|
),*/
|
||||||
minScale: PhotoViewComputedScale.contained * 0.8,
|
minScale: PhotoViewComputedScale.contained * 0.8,
|
||||||
maxScale: PhotoViewComputedScale.contained * 3.0,
|
maxScale: PhotoViewComputedScale.contained * 3.0,
|
||||||
backgroundDecoration: BoxDecoration(
|
backgroundDecoration: BoxDecoration(
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:auto_size_text/auto_size_text.dart';
|
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/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';
|
||||||
@ -220,9 +221,9 @@ boxDecoration(SectionDTO section, bool isSelected) {
|
|||||||
image: section.imageSource != null ? new DecorationImage(
|
image: section.imageSource != null ? new DecorationImage(
|
||||||
fit: kIsWeb ? BoxFit.cover : BoxFit.contain,
|
fit: kIsWeb ? BoxFit.cover : BoxFit.contain,
|
||||||
colorFilter: !isSelected? new ColorFilter.mode(Colors.black.withOpacity(0.3), BlendMode.dstATop) : null,
|
colorFilter: !isSelected? new ColorFilter.mode(Colors.black.withOpacity(0.3), BlendMode.dstATop) : null,
|
||||||
image: new NetworkImage(
|
image: CachedNetworkImageProvider(section.imageSource!), /*new NetworkImage(
|
||||||
section.imageSource!,
|
section.imageSource!,
|
||||||
),
|
),*/
|
||||||
): null,
|
): null,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:tablet_app/Models/tabletContext.dart';
|
import 'package:tablet_app/Models/tabletContext.dart';
|
||||||
import 'package:tablet_app/app_context.dart';
|
import 'package:tablet_app/app_context.dart';
|
||||||
import 'package:tablet_app/constants.dart';
|
|
||||||
|
|
||||||
class PuzzlePiece extends StatefulWidget {
|
class PuzzlePiece extends StatefulWidget {
|
||||||
final Image image;
|
final CachedNetworkImage image;
|
||||||
final Size imageSize;
|
final Size imageSize;
|
||||||
final int row;
|
final int row;
|
||||||
final int col;
|
final int col;
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import 'dart:convert';
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_api/api.dart';
|
import 'package:manager_api/api.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
@ -44,20 +45,27 @@ class _PuzzleView extends State<PuzzleView> {
|
|||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
final appContext = Provider.of<AppContext>(context, listen: false);
|
final appContext = Provider.of<AppContext>(context, listen: false);
|
||||||
TabletAppContext tabletAppContext = appContext.getContext();
|
TabletAppContext tabletAppContext = appContext.getContext();
|
||||||
TranslationAndResourceDTO? messageDebut = puzzleDTO.messageDebut != null ? puzzleDTO.messageDebut!.firstWhere((message) => message.language!.toUpperCase() == tabletAppContext.language!.toUpperCase()) : null;
|
|
||||||
|
print(puzzleDTO.messageDebut);
|
||||||
|
TranslationAndResourceDTO? messageDebut = puzzleDTO.messageDebut != null && puzzleDTO.messageDebut!.length > 0 ? puzzleDTO.messageDebut!.firstWhere((message) => message.language!.toUpperCase() == tabletAppContext.language!.toUpperCase()) : null;
|
||||||
|
|
||||||
if(messageDebut != null) {
|
if(messageDebut != null) {
|
||||||
showMessage(messageDebut, appContext, context, size);
|
showMessage(messageDebut, appContext, context, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
getRealWidgetSize();
|
getRealWidgetSize();
|
||||||
|
|
||||||
|
if(puzzleDTO.image != null && puzzleDTO.image!.resourceUrl != null) {
|
||||||
|
//splitImage(Image.network(puzzleDTO.image!.resourceUrl!));
|
||||||
|
splitImage(CachedNetworkImage(
|
||||||
|
imageUrl: puzzleDTO.image!.resourceUrl!,
|
||||||
|
fit: BoxFit.fill,
|
||||||
|
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||||
|
));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
if(puzzleDTO.image != null && puzzleDTO.image!.resourceUrl != null) {
|
|
||||||
splitImage(Image.network(puzzleDTO.image!.resourceUrl!));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getRealWidgetSize() async {
|
Future<void> getRealWidgetSize() async {
|
||||||
@ -71,27 +79,67 @@ class _PuzzleView extends State<PuzzleView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we need to find out the image size, to be used in the PuzzlePiece widget
|
// we need to find out the image size, to be used in the PuzzlePiece widget
|
||||||
Future<Size> getImageSize(Image image) async {
|
/*Future<Size> getImageSize(CachedNetworkImage image) async {
|
||||||
Completer<Size> completer = Completer<Size>();
|
Completer<Size> completer = Completer<Size>();
|
||||||
|
|
||||||
image.image
|
/*image.image
|
||||||
|
.resolve(const ImageConfiguration())
|
||||||
|
.addListener(ImageStreamListener((ImageInfo info, bool _) {
|
||||||
|
completer.complete(
|
||||||
|
Size(info.image.width.toDouble(), info.image.height.toDouble()));
|
||||||
|
}));*/
|
||||||
|
|
||||||
|
CachedNetworkImage(
|
||||||
|
imageUrl: 'https://example.com/image.jpg',
|
||||||
|
placeholder: (context, url) => CircularProgressIndicator(),
|
||||||
|
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||||
|
imageBuilder: (BuildContext context, ImageProvider imageProvider) {
|
||||||
|
Completer<Size> completer = Completer<Size>();
|
||||||
|
|
||||||
|
imageProvider
|
||||||
.resolve(const ImageConfiguration())
|
.resolve(const ImageConfiguration())
|
||||||
.addListener(ImageStreamListener((ImageInfo info, bool _) {
|
.addListener(ImageStreamListener((ImageInfo info, bool _) {
|
||||||
completer.complete(
|
completer.complete(
|
||||||
Size(info.image.width.toDouble(), info.image.height.toDouble()));
|
Size(info.image.width.toDouble(), info.image.height.toDouble()));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
return CachedNetworkImage(
|
||||||
|
imageUrl: 'https://example.com/image.jpg',
|
||||||
|
placeholder: (context, url) => CircularProgressIndicator(),
|
||||||
|
errorWidget: (context, url, error) => Icon(Icons.error),
|
||||||
|
imageBuilder: (context, imageProvider) {
|
||||||
|
return Image(
|
||||||
|
image: imageProvider,
|
||||||
|
loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
|
||||||
|
if (loadingProgress == null) {
|
||||||
|
return child;
|
||||||
|
} else {
|
||||||
|
return Center(
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
value: loadingProgress.expectedTotalBytes != null
|
||||||
|
? loadingProgress.cumulativeBytesLoaded / (loadingProgress.expectedTotalBytes ?? 1)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
Size imageSize = await completer.future;
|
Size imageSize = await completer.future;
|
||||||
|
|
||||||
return imageSize;
|
return imageSize;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// here we will split the image into small pieces
|
// here we will split the image into small pieces
|
||||||
// using the rows and columns defined above; each piece will be added to a stack
|
// using the rows and columns defined above; each piece will be added to a stack
|
||||||
void splitImage(Image image) async {
|
void splitImage(CachedNetworkImage image) async {
|
||||||
Size imageSize = await getImageSize(image);
|
//Size imageSize = await getImageSize(image);
|
||||||
//imageSize = realWidgetSize!;
|
//imageSize = realWidgetSize!;
|
||||||
imageSize = Size(realWidgetSize!.width * 1.25, realWidgetSize!.height * 1.25);
|
Size imageSize = Size(realWidgetSize!.width * 1.25, realWidgetSize!.height * 1.25);
|
||||||
|
|
||||||
for (int x = 0; x < puzzleDTO.rows!; x++) {
|
for (int x = 0; x < puzzleDTO.rows!; x++) {
|
||||||
for (int y = 0; y < puzzleDTO.cols!; y++) {
|
for (int y = 0; y < puzzleDTO.cols!; y++) {
|
||||||
@ -139,7 +187,7 @@ class _PuzzleView extends State<PuzzleView> {
|
|||||||
Size size = MediaQuery.of(context).size;
|
Size size = MediaQuery.of(context).size;
|
||||||
final appContext = Provider.of<AppContext>(context, listen: false);
|
final appContext = Provider.of<AppContext>(context, listen: false);
|
||||||
TabletAppContext tabletAppContext = appContext.getContext();
|
TabletAppContext tabletAppContext = appContext.getContext();
|
||||||
TranslationAndResourceDTO? messageFin = puzzleDTO.messageFin != null ? puzzleDTO.messageFin!.firstWhere((message) => message.language!.toUpperCase() == tabletAppContext.language!.toUpperCase()) : null;
|
TranslationAndResourceDTO? messageFin = puzzleDTO.messageFin != null && puzzleDTO.messageFin!.length > 0 ? puzzleDTO.messageFin!.firstWhere((message) => message.language!.toUpperCase() == tabletAppContext.language!.toUpperCase()) : null;
|
||||||
|
|
||||||
if(messageFin != null) {
|
if(messageFin != null) {
|
||||||
showMessage(messageFin, appContext, context, size);
|
showMessage(messageFin, appContext, context, size);
|
||||||
@ -158,27 +206,13 @@ class _PuzzleView extends State<PuzzleView> {
|
|||||||
padding: const EdgeInsets.all(10.0),
|
padding: const EdgeInsets.all(10.0),
|
||||||
child: isSplittingImage ? Center(child: LoadingCommon()) :
|
child: isSplittingImage ? Center(child: LoadingCommon()) :
|
||||||
puzzleDTO.image!.resourceUrl == null || realWidgetSize == null
|
puzzleDTO.image!.resourceUrl == null || realWidgetSize == null
|
||||||
? Container(
|
? Center(child: Text("Invalid image"))
|
||||||
width: 50,
|
|
||||||
height: 50,
|
|
||||||
color: Colors.cyan,
|
|
||||||
child: InkWell(onTap: () {
|
|
||||||
Size size = MediaQuery.of(context).size;
|
|
||||||
final appContext = Provider.of<AppContext>(context, listen: false);
|
|
||||||
TabletAppContext tabletAppContext = appContext.getContext();
|
|
||||||
TranslationAndResourceDTO? messageFin = puzzleDTO.messageFin != null ? puzzleDTO.messageFin!.firstWhere((message) => message.language!.toUpperCase() == tabletAppContext.language!.toUpperCase()) : null;
|
|
||||||
|
|
||||||
if(messageFin != null) {
|
|
||||||
// Alert dialog
|
|
||||||
showMessage(messageFin, appContext, context, size);
|
|
||||||
}
|
|
||||||
},),)//Center(child: Text("Invalid image"))
|
|
||||||
: Center(
|
: Center(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Container(
|
child: Container(
|
||||||
width: tabletAppContext.puzzleSize != null ? tabletAppContext.puzzleSize!.width : realWidgetSize!.width * 0.8,
|
width: tabletAppContext.puzzleSize != null && tabletAppContext.puzzleSize!.width > 0 ? tabletAppContext.puzzleSize!.width : realWidgetSize!.width * 0.8,
|
||||||
height: tabletAppContext.puzzleSize != null ? tabletAppContext.puzzleSize!.height +1.5 : realWidgetSize!.height * 0.8,
|
height: tabletAppContext.puzzleSize != null && tabletAppContext.puzzleSize!.height > 0 ? tabletAppContext.puzzleSize!.height +1.5 : realWidgetSize!.height * 0.85,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
children: pieces,
|
children: pieces,
|
||||||
),
|
),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
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:confetti/confetti.dart';
|
import 'package:confetti/confetti.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
@ -123,9 +124,9 @@ class _QuizzView extends State<QuizzView> {
|
|||||||
image: levelToShow.source_ != null ? new DecorationImage(
|
image: levelToShow.source_ != null ? new DecorationImage(
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
opacity: 0.85,
|
opacity: 0.85,
|
||||||
image: new NetworkImage(
|
image: CachedNetworkImageProvider(levelToShow.source_), /*new NetworkImage(
|
||||||
levelToShow.source_,
|
levelToShow.source_,
|
||||||
),
|
)*/
|
||||||
): null,
|
): null,
|
||||||
borderRadius: BorderRadius.all( Radius.circular(50.0)),
|
borderRadius: BorderRadius.all( Radius.circular(50.0)),
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
@ -138,9 +139,9 @@ class _QuizzView extends State<QuizzView> {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: const Color(0xff7c94b6),
|
color: const Color(0xff7c94b6),
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: new NetworkImage(
|
image: CachedNetworkImageProvider(levelToShow.source_),/*new NetworkImage(
|
||||||
levelToShow.source_,
|
levelToShow.source_,
|
||||||
),
|
),*/
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
borderRadius: BorderRadius.all( Radius.circular(50.0)),
|
borderRadius: BorderRadius.all( Radius.circular(50.0)),
|
||||||
@ -306,9 +307,9 @@ class _QuizzView extends State<QuizzView> {
|
|||||||
image: i.resourceUrl != null ? new DecorationImage(
|
image: i.resourceUrl != null ? new DecorationImage(
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
opacity: 0.35,
|
opacity: 0.35,
|
||||||
image: new NetworkImage(
|
image: CachedNetworkImageProvider(i.resourceUrl!),/* new NetworkImage(
|
||||||
i.resourceUrl!,
|
i.resourceUrl!,
|
||||||
),
|
),*/
|
||||||
): null,
|
): null,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
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/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
@ -79,9 +80,9 @@ class _ShowReponsesWidget extends State<ShowReponsesWidget> {
|
|||||||
image: i.resourceUrl != null ? new DecorationImage(
|
image: i.resourceUrl != null ? new DecorationImage(
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
opacity: 0.35,
|
opacity: 0.35,
|
||||||
image: new NetworkImage(
|
image: CachedNetworkImageProvider(i.resourceUrl!),/*new NetworkImage(
|
||||||
i.resourceUrl!,
|
i.resourceUrl!,
|
||||||
),
|
),*/
|
||||||
): null,
|
): null,
|
||||||
boxShadow: [
|
boxShadow: [
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
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/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
@ -252,9 +253,9 @@ class _SliderView extends State<SliderView> {
|
|||||||
case ResourceType.Image:
|
case ResourceType.Image:
|
||||||
case ResourceType.ImageUrl:
|
case ResourceType.ImageUrl:
|
||||||
widgetToInclude = PhotoView(
|
widgetToInclude = PhotoView(
|
||||||
imageProvider: new NetworkImage(
|
imageProvider: CachedNetworkImageProvider(i.resourceUrl!),/*new NetworkImage(
|
||||||
i.resourceUrl!,
|
i.resourceUrl!,
|
||||||
),
|
),*/
|
||||||
minScale: PhotoViewComputedScale.contained * 0.8,
|
minScale: PhotoViewComputedScale.contained * 0.8,
|
||||||
maxScale: PhotoViewComputedScale.contained * 3.0,
|
maxScale: PhotoViewComputedScale.contained * 3.0,
|
||||||
backgroundDecoration: BoxDecoration(
|
backgroundDecoration: BoxDecoration(
|
||||||
|
|||||||
@ -4,8 +4,9 @@ import 'package:flutter/foundation.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:manager_api/api.dart';
|
import 'package:manager_api/api.dart';
|
||||||
import 'package:tablet_app/constants.dart';
|
import 'package:tablet_app/constants.dart';
|
||||||
import 'package:youtube_player_iframe/youtube_player_iframe.dart' as iframe;
|
|
||||||
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
|
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
|
||||||
|
import 'package:youtube_player_iframe/youtube_player_iframe.dart' as iframe;
|
||||||
|
//import 'package:youtube_player_flutter/youtube_player_flutter.dart';
|
||||||
|
|
||||||
class VideoView extends StatefulWidget {
|
class VideoView extends StatefulWidget {
|
||||||
final SectionDTO? section;
|
final SectionDTO? section;
|
||||||
|
|||||||
@ -99,10 +99,11 @@ class _MyAppState extends State<MyApp> {
|
|||||||
const Locale('fr', 'FR'),
|
const Locale('fr', 'FR'),
|
||||||
],*/
|
],*/
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
|
primaryColor: widget.tabletAppContext != null ? widget.tabletAppContext!.configuration != null ? widget.tabletAppContext!.configuration!.primaryColor != null ? new Color(int.parse(widget.tabletAppContext!.configuration!.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kTestSecondColor : kTestSecondColor : kTestSecondColor,
|
||||||
primarySwatch: Colors.grey,
|
primarySwatch: Colors.grey,
|
||||||
scaffoldBackgroundColor: widget.tabletAppContext != null ? widget.tabletAppContext!.configuration != null ? widget.tabletAppContext!.configuration!.secondaryColor != null ? new Color(int.parse(widget.tabletAppContext!.configuration!.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : kBackgroundGrey : kBackgroundGrey,
|
scaffoldBackgroundColor: widget.tabletAppContext != null ? widget.tabletAppContext!.configuration != null ? widget.tabletAppContext!.configuration!.secondaryColor != null ? new Color(int.parse(widget.tabletAppContext!.configuration!.secondaryColor!.split('(0x')[1].split(')')[0], radix: 16)): kBackgroundGrey : kBackgroundGrey : kBackgroundGrey,
|
||||||
//fontFamily: "Vollkorn",
|
//fontFamily: "Vollkorn",
|
||||||
textTheme: TextTheme(bodyText1: TextStyle(color: kMainRed)),
|
textTheme: TextTheme(bodyLarge: TextStyle(color: kMainRed)),
|
||||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||||
),
|
),
|
||||||
routes: {
|
routes: {
|
||||||
@ -114,4 +115,3 @@ class _MyAppState extends State<MyApp> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,22 +9,20 @@ import audio_session
|
|||||||
import firebase_core
|
import firebase_core
|
||||||
import firebase_storage
|
import firebase_storage
|
||||||
import just_audio
|
import just_audio
|
||||||
import package_info_plus
|
|
||||||
import path_provider_foundation
|
import path_provider_foundation
|
||||||
|
import shared_preferences_foundation
|
||||||
import sqflite
|
import sqflite
|
||||||
import url_launcher_macos
|
import url_launcher_macos
|
||||||
import video_player_avfoundation
|
import wakelock_macos
|
||||||
import wakelock_plus
|
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||||
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
|
||||||
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
|
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
|
||||||
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
||||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
|
||||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||||
FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
|
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
|
||||||
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,11 +47,14 @@ dependencies:
|
|||||||
confetti: ^0.7.0
|
confetti: ^0.7.0
|
||||||
flutter_launcher_icons: ^0.13.1 # All but web
|
flutter_launcher_icons: ^0.13.1 # All but web
|
||||||
#flutter_svg_provider: ^1.0.6
|
#flutter_svg_provider: ^1.0.6
|
||||||
flutter_widget_from_html: ^0.10.1
|
flutter_widget_from_html: ^0.14.10+1
|
||||||
flutter_pdfview: ^1.3.2
|
flutter_pdfview: ^1.3.2
|
||||||
firebase_storage: ^11.5.6
|
firebase_storage: ^11.5.6
|
||||||
firebase_core: ^2.24.2
|
firebase_core: ^2.24.2
|
||||||
video_player: ^2.8.1
|
#video_player: ^2.8.1
|
||||||
|
cached_video_player: ^2.0.4
|
||||||
|
cached_network_image: ^3.3.1
|
||||||
|
just_audio_cache: ^0.1.2
|
||||||
|
|
||||||
openapi_generator_cli: ^4.13.1
|
openapi_generator_cli: ^4.13.1
|
||||||
openapi_generator: ^4.13.1
|
openapi_generator: ^4.13.1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user