OpenMediacenterMobileFlutter/lib/video_feed.dart

39 lines
905 B
Dart
Raw Normal View History

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