...
This commit is contained in:
parent
ca8f45ec7c
commit
69de940e33
@ -32,6 +32,8 @@ class MediaItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String get thumbnailUrl => 'https://f0ck.me/t/$id.webp';
|
String get thumbnailUrl => 'https://f0ck.me/t/$id.webp';
|
||||||
|
String get mediaUrl => 'https://f0ck.me/b/$dest';
|
||||||
|
String get coverUrl => 'https://f0ck.me/ca/$id.webp';
|
||||||
}
|
}
|
||||||
|
|
||||||
class Tag {
|
class Tag {
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
class MediaItemDetail {
|
|
||||||
final int id;
|
|
||||||
final String mime;
|
|
||||||
final String dest;
|
|
||||||
final String username;
|
|
||||||
final int stamp;
|
|
||||||
final int? next;
|
|
||||||
final int? prev;
|
|
||||||
|
|
||||||
MediaItemDetail({
|
|
||||||
required this.id,
|
|
||||||
required this.mime,
|
|
||||||
required this.dest,
|
|
||||||
required this.username,
|
|
||||||
required this.stamp,
|
|
||||||
required this.next,
|
|
||||||
required this.prev,
|
|
||||||
});
|
|
||||||
|
|
||||||
factory MediaItemDetail.fromJson(Map<String, dynamic> json) {
|
|
||||||
return MediaItemDetail(
|
|
||||||
id: json['id'],
|
|
||||||
mime: json['mime'],
|
|
||||||
dest: json['dest'],
|
|
||||||
username: json['username'],
|
|
||||||
stamp: json['stamp'],
|
|
||||||
next: json['next'],
|
|
||||||
prev: json['prev'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
String get mediaUrl => 'https://f0ck.me/b/$dest';
|
|
||||||
}
|
|
@ -98,7 +98,7 @@ class _DetailViewState extends State<DetailView> {
|
|||||||
children: [
|
children: [
|
||||||
if (item.mime.startsWith('image')) ...[
|
if (item.mime.startsWith('image')) ...[
|
||||||
Image.network(
|
Image.network(
|
||||||
'https://f0ck.me/b/${item.dest}',
|
item.mediaUrl,
|
||||||
fit: BoxFit.contain,
|
fit: BoxFit.contain,
|
||||||
),
|
),
|
||||||
] else ...[
|
] else ...[
|
||||||
|
@ -2,7 +2,7 @@ import 'dart:convert';
|
|||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
import 'package:f0ckapp/models/mediaitem.dart';
|
import 'package:f0ckapp/models/mediaitem.dart';
|
||||||
import 'package:f0ckapp/models/mediaitem_detail.dart';
|
//import 'package:f0ckapp/models/mediaitem_detail.dart';
|
||||||
|
|
||||||
Future<List<MediaItem>> fetchMedia({String? older, String? mode}) async {
|
Future<List<MediaItem>> fetchMedia({String? older, String? mode}) async {
|
||||||
final Uri url = Uri.parse('https://api.f0ck.me/items/get')
|
final Uri url = Uri.parse('https://api.f0ck.me/items/get')
|
||||||
@ -20,7 +20,7 @@ Future<List<MediaItem>> fetchMedia({String? older, String? mode}) async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<MediaItemDetail> fetchMediaDetail(int itemId) async {
|
/*Future<MediaItemDetail> fetchMediaDetail(int itemId) async {
|
||||||
final Uri url = Uri.parse('https://f0ck.me/api/v2/item/${itemId.toString()}');
|
final Uri url = Uri.parse('https://f0ck.me/api/v2/item/${itemId.toString()}');
|
||||||
|
|
||||||
final response = await http.get(url);
|
final response = await http.get(url);
|
||||||
@ -30,4 +30,4 @@ Future<MediaItemDetail> fetchMediaDetail(int itemId) async {
|
|||||||
} else {
|
} else {
|
||||||
throw Exception('Fehler beim Abrufen der Media-Details: ${response.statusCode}');
|
throw Exception('Fehler beim Abrufen der Media-Details: ${response.statusCode}');
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
@ -20,7 +20,7 @@ class _VideoWidgetState extends State<VideoWidget> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _initController() async {
|
Future<void> _initController() async {
|
||||||
_controller = VideoPlayerController.networkUrl(Uri.parse('https://f0ck.me/b/${widget.details.dest}'));
|
_controller = VideoPlayerController.networkUrl(Uri.parse(widget.details.mediaUrl));
|
||||||
await _controller.initialize();
|
await _controller.initialize();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ class _VideoWidgetState extends State<VideoWidget> {
|
|||||||
},
|
},
|
||||||
child: isAudio
|
child: isAudio
|
||||||
? Image.network(
|
? Image.network(
|
||||||
'https://f0ck.me/ca/${widget.details.id}.webp',
|
widget.details.coverUrl,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
)
|
)
|
||||||
: VideoPlayer(_controller),
|
: VideoPlayer(_controller),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user