OpenMediacenterMobileFlutter/lib/preview/actor_feed.dart
lukas-heiligenbrunner 5fc77b4abb linux build
cache previews in sqlite db
actor page
outsouce different players in seperate classes
2022-08-28 22:51:12 +02:00

38 lines
852 B
Dart

import 'dart:convert';
import 'package:flutter/material.dart';
import '../api/api.dart';
import 'preview_grid.dart';
import '../types/actor.dart';
import '../types/video.dart';
class ActorFeed extends StatefulWidget {
const ActorFeed({Key? key, required this.actor}) : super(key: key);
final Actor actor;
@override
State<ActorFeed> createState() => _ActorFeedState();
}
class _ActorFeedState extends State<ActorFeed> {
Future<List<VideoT>> loadData() async {
final data = await API
.query("actor", "getActorInfo", {'ActorId': widget.actor.actorId});
final d = jsonDecode(data);
List<VideoT> dta =
(d['Videos'] as List).map((e) => VideoT.fromJson(e)).toList();
return dta;
}
@override
Widget build(BuildContext context) {
return PreviewGrid(
videoLoader: () => loadData(),
);
}
}