mirror of
https://bitbucket.org/FransoletThomas/tablet-app.git
synced 2025-12-06 16:41:19 +00:00
Show default message when null or empty
This commit is contained in:
parent
da8b3d88de
commit
ba70827448
@ -145,12 +145,14 @@ class _SliderViewWidget extends State<SliderViewWidget> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Positioned(
|
if(sliderDTO.images != null && sliderDTO.images.length > 1)
|
||||||
|
Positioned(
|
||||||
top: MediaQuery.of(context).size.height * 0.35,
|
top: MediaQuery.of(context).size.height * 0.35,
|
||||||
right: 60,
|
right: 60,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
sliderController.nextPage(duration: new Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
|
if (sliderDTO.images.length > 0)
|
||||||
|
sliderController.nextPage(duration: new Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
|
||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.chevron_right,
|
Icons.chevron_right,
|
||||||
@ -159,12 +161,14 @@ class _SliderViewWidget extends State<SliderViewWidget> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Positioned(
|
if(sliderDTO.images != null && sliderDTO.images.length > 1)
|
||||||
|
Positioned(
|
||||||
top: MediaQuery.of(context).size.height * 0.35,
|
top: MediaQuery.of(context).size.height * 0.35,
|
||||||
left: 60,
|
left: 60,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
sliderController.previousPage(duration: new Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
|
if (sliderDTO.images.length > 0)
|
||||||
|
sliderController.previousPage(duration: new Duration(milliseconds: 500), curve: Curves.fastOutSlowIn);
|
||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.chevron_left,
|
Icons.chevron_left,
|
||||||
@ -189,6 +193,8 @@ class _SliderViewWidget extends State<SliderViewWidget> {
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if(sliderDTO.images == null || sliderDTO.images.length == 0)
|
||||||
|
Center(child: Text("Aucune image à afficher"))
|
||||||
// Description
|
// Description
|
||||||
/*Container(
|
/*Container(
|
||||||
height: sliderDTO.images != null && sliderDTO.images.length > 0 ? size.height *0.3 : size.height *0.6,
|
height: sliderDTO.images != null && sliderDTO.images.length > 0 ? size.height *0.3 : size.height *0.6,
|
||||||
|
|||||||
@ -23,31 +23,32 @@ class _VideoViewWidget extends State<VideoViewWidget> {
|
|||||||
print(videoDTO);
|
print(videoDTO);
|
||||||
|
|
||||||
String videoId;
|
String videoId;
|
||||||
videoId = YoutubePlayer.convertUrlToId(videoDTO.source_);
|
if (videoDTO.source_ != null && videoDTO.source_.length > 0 ) {
|
||||||
print(videoId);
|
videoId = YoutubePlayer.convertUrlToId(videoDTO.source_);
|
||||||
|
|
||||||
super.initState();
|
YoutubePlayerController _controller = YoutubePlayerController(
|
||||||
|
initialVideoId: videoId,
|
||||||
|
flags: YoutubePlayerFlags(
|
||||||
|
autoPlay: true,
|
||||||
|
controlsVisibleAtStart: false,
|
||||||
|
loop: true,
|
||||||
|
hideControls: false,
|
||||||
|
hideThumbnail: false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
YoutubePlayerController _controller = YoutubePlayerController(
|
_videoView = YoutubePlayer(
|
||||||
initialVideoId: videoId,
|
controller: _controller,
|
||||||
flags: YoutubePlayerFlags(
|
showVideoProgressIndicator: false,
|
||||||
autoPlay: true,
|
/*progressIndicatorColor: Colors.amber,
|
||||||
controlsVisibleAtStart: false,
|
|
||||||
loop: true,
|
|
||||||
hideControls: false,
|
|
||||||
hideThumbnail: false,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
_videoView = YoutubePlayer(
|
|
||||||
controller: _controller,
|
|
||||||
showVideoProgressIndicator: false,
|
|
||||||
/*progressIndicatorColor: Colors.amber,
|
|
||||||
progressColors: ProgressBarColors(
|
progressColors: ProgressBarColors(
|
||||||
playedColor: Colors.amber,
|
playedColor: Colors.amber,
|
||||||
handleColor: Colors.amberAccent,
|
handleColor: Colors.amberAccent,
|
||||||
),*/
|
),*/
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -57,5 +58,5 @@ class _VideoViewWidget extends State<VideoViewWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => _videoView;
|
Widget build(BuildContext context) => videoDTO.source_ != null && videoDTO.source_.length > 0 ? _videoView : Center(child: Text("La vidéo ne peut pas être affichée, l'url est incorrecte"));
|
||||||
}
|
}
|
||||||
@ -45,5 +45,5 @@ class _WebViewWidget extends State<WebViewWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => _webView;
|
Widget build(BuildContext context) => webDTO.source_ != null && webDTO.source_.length > 0 ? _webView : Center(child: Text("La page internet ne peut pas être affichée, l'url est incorrecte ou vide"));
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user