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 createState() => _ActorFeedState(); } class _ActorFeedState extends State { Future> loadData() async { final data = await API .query("actor", "getActorInfo", {'ActorId': widget.actor.actorId}); final d = jsonDecode(data); List dta = (d['Videos'] as List).map((e) => VideoT.fromJson(e)).toList(); return dta; } @override Widget build(BuildContext context) { return PreviewGrid( videoLoader: () => loadData(), ); } }