57 lines
1.1 KiB
Dart
57 lines
1.1 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'api/api.dart';
|
|
|
|
class VideoT {
|
|
int id;
|
|
String title;
|
|
double Ratio;
|
|
|
|
VideoT(this.title, this.id, this.Ratio);
|
|
|
|
factory VideoT.fromJson(dynamic json) {
|
|
return VideoT(json['MovieName'] as String, json['MovieId'] as int,
|
|
(json['Ratio'] as num).toDouble());
|
|
}
|
|
}
|
|
|
|
class PreviewTile extends StatefulWidget {
|
|
const PreviewTile({Key? key, required this.dta}) : super(key: key);
|
|
final VideoT dta;
|
|
|
|
@override
|
|
_PreviewTileState createState() => _PreviewTileState();
|
|
}
|
|
|
|
class _PreviewTileState extends State<PreviewTile> {
|
|
String prev = "";
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
API.query("video", "readThumbnail", {'Movieid': widget.dta.id}).then(
|
|
(value) {
|
|
setState(() {
|
|
prev = value.substring(23);
|
|
});
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
child: Column(
|
|
children: [
|
|
Text(widget.dta.title),
|
|
prev != ""
|
|
? Image.memory(base64Decode(prev))
|
|
: const CircularProgressIndicator()
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|