diff --git a/lib/Screens/Slider/slider_view.dart b/lib/Screens/Slider/slider_view.dart index 4dd3fc3..c2fbeff 100644 --- a/lib/Screens/Slider/slider_view.dart +++ b/lib/Screens/Slider/slider_view.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:manager_api/api.dart'; import 'package:provider/provider.dart'; +import 'package:tablet_app/Components/show_element_for_resource.dart'; import 'package:tablet_app/Components/video_viewer.dart'; import 'package:tablet_app/app_context.dart'; import 'package:tablet_app/constants.dart'; @@ -110,29 +111,7 @@ class _SliderView extends State { ),*/ child: Stack( children: [ - 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: VideoViewer(videoUrl: "https://firebasestorage.googleapis.com/v0/b/mymuseum-3b97f.appspot.com/o/All%2024%20Cybertruck%20Accessories%20Revealed!.mp4?alt=media&token=fc178259-10fc-4167-b496-cf7d04aaae5e")/*PhotoView( - imageProvider: new NetworkImage( - i.source_!, - ), - minScale: PhotoViewComputedScale.contained * 0.8, - maxScale: PhotoViewComputedScale.contained * 3.0, - backgroundDecoration: BoxDecoration( - color: kBackgroundSecondGrey, - shape: BoxShape.rectangle, - borderRadius: BorderRadius.circular(15.0), - ), - ),*/ - ), - ), - ), - ), + getElementForResource(appContext, i), Positioned( bottom: 0, right: 0, @@ -268,4 +247,51 @@ class _SliderView extends State { ] ); } + + getElementForResource(AppContext appContext, ContentDTO i) { + var widgetToInclude; + print("TTTTTTTTTTTTTTESSSSSSSSSSSt CONTENTR"); + print(i); + print(i.resourceUrl); + print(i.resourceType); + + switch(i.resourceType) { + case ResourceType.Image: + case ResourceType.ImageUrl: + widgetToInclude = PhotoView( + imageProvider: new NetworkImage( + i.resourceUrl!, + ), + minScale: PhotoViewComputedScale.contained * 0.8, + maxScale: PhotoViewComputedScale.contained * 3.0, + backgroundDecoration: BoxDecoration( + color: kBackgroundSecondGrey, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(15.0), + ), + ); + break; + case ResourceType.Video: + case ResourceType.VideoUrl: + case ResourceType.Audio: + widgetToInclude = showElementForResource(ResourceDTO(id: i.resourceId, url: i.resourceUrl, type: i.resourceType), appContext); + break; + } + + print("TTTTTTTTTTTTTTESSSSSSSSSSSt"); + print(widgetToInclude); + + 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, + ), + ), + ), + ); + } } \ No newline at end of file