lukas-heiligenbrunner
a7757b14dd
outsource preview table in several function revert android compile version
53 lines
1.1 KiB
Dart
53 lines
1.1 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'api/api.dart';
|
|
import 'api/token.dart';
|
|
import 'log/log.dart';
|
|
|
|
class VideoScreen extends StatefulWidget {
|
|
const VideoScreen({Key? key, required this.videoID}) : super(key: key);
|
|
final int videoID;
|
|
|
|
@override
|
|
State<VideoScreen> createState() => _VideoScreenState();
|
|
}
|
|
|
|
class _VideoScreenState extends State<VideoScreen> {
|
|
void loadData() async {
|
|
final data =
|
|
await API.query("video", "loadVideo", {'MovieId': widget.videoID});
|
|
|
|
final d = jsonDecode(data);
|
|
|
|
final url = d["MovieUrl"];
|
|
final token = await Token.getInstance().getToken();
|
|
if (token == null) return;
|
|
|
|
final baseurl = token.domain;
|
|
// todo not static middle path
|
|
final String path = baseurl + "/videos/vids/" + url;
|
|
Log.d(path);
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
loadData();
|
|
|
|
// todo hide appbar after some seonds
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Second Route'),
|
|
),
|
|
body: const Center(child: Text("Todo to implement")),
|
|
);
|
|
}
|
|
}
|