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