OpenMediacenterMobileFlutter/lib/navigation/video_feed.dart
lukas-heiligenbrunner 41a133b6c4 new categorie page
better folder structure
more info on video info page
2022-08-28 18:48:53 +02:00

44 lines
1.0 KiB
Dart

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:openmediacentermobile/api/api.dart';
import 'package:openmediacentermobile/preview/preview_grid.dart';
import '../log/log.dart';
import '../preview/preview_tile.dart';
import '../types/tag.dart';
class VideoFeed extends StatefulWidget {
const VideoFeed({Key? key, this.tag}) : super(key: key);
final Tag? tag;
@override
State<StatefulWidget> createState() {
return VideoFeedState();
}
}
class VideoFeedState extends State<VideoFeed> {
Future<List<VideoT>> loadData() async {
final data = await API.query(
"video", "getMovies", {'Tag': widget.tag?.tagId ?? 1, 'Sort': 0});
final d = jsonDecode(data);
List<VideoT> dta =
(d['Videos'] as List).map((e) => VideoT.fromJson(e)).toList();
return dta;
}
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
Log.d(width);
return PreviewGrid(
videoLoader: () => loadData(),
);
}
}