wip slider

This commit is contained in:
Thomas Fransolet 2023-12-29 15:33:03 +01:00
parent cad16a35d3
commit 7afe94b564

View File

@ -6,6 +6,7 @@ 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';
import 'package:manager_api/api.dart'; import 'package:manager_api/api.dart';
import 'package:provider/provider.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/Components/video_viewer.dart';
import 'package:tablet_app/app_context.dart'; import 'package:tablet_app/app_context.dart';
import 'package:tablet_app/constants.dart'; import 'package:tablet_app/constants.dart';
@ -110,29 +111,7 @@ class _SliderView extends State<SliderView> {
),*/ ),*/
child: Stack( child: Stack(
children: [ children: [
Center( getElementForResource(appContext, i),
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),
),
),*/
),
),
),
),
Positioned( Positioned(
bottom: 0, bottom: 0,
right: 0, right: 0,
@ -268,4 +247,51 @@ class _SliderView extends State<SliderView> {
] ]
); );
} }
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,
),
),
),
);
}
} }