38 lines
852 B
Dart
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(),
|
||
|
);
|
||
|
}
|
||
|
}
|