OpenMediacenterMobileFlutter/lib/video_feed.dart
lukas-heiligenbrunner a7757b14dd format, lint
outsource preview table in several function
revert android compile version
2022-08-25 22:48:44 +02:00

41 lines
924 B
Dart

import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:openmediacentermobile/api/api.dart';
import 'package:openmediacentermobile/preview_grid.dart';
import 'log/log.dart';
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;
}
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
Log.d(width);
return PreviewGrid(
videoLoader: () => loadData(),
);
}
}