mirror of
https://github.com/feeddeck/feeddeck.git
synced 2026-04-30 11:28:45 -05:00
It is now possible to play videos from toots within FeedDeck. For that we are using the "madia_kit" package, which is already used for the Podcast player on Windows and Linux. The videos from a toot are saved within the "options.videos" field of an item next to the "options.media" field. In the "ItemDetailsMastodon" widget we are then checking if this field is present and contains a list of video urls. These urls can then be played via the "ItemVideos" widget.
53 lines
1.7 KiB
Dart
53 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:feeddeck/models/item.dart';
|
|
import 'package:feeddeck/models/source.dart';
|
|
import 'package:feeddeck/widgets/item/preview/utils/details.dart';
|
|
import 'package:feeddeck/widgets/item/preview/utils/item_actions.dart';
|
|
import 'package:feeddeck/widgets/item/preview/utils/item_description.dart';
|
|
import 'package:feeddeck/widgets/item/preview/utils/item_media_gallery.dart';
|
|
import 'package:feeddeck/widgets/item/preview/utils/item_source.dart';
|
|
|
|
class ItemPreviewMastodon extends StatelessWidget {
|
|
const ItemPreviewMastodon({
|
|
super.key,
|
|
required this.item,
|
|
required this.source,
|
|
});
|
|
|
|
final FDItem item;
|
|
final FDSource source;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ItemActions(
|
|
item: item,
|
|
onTap: () => showDetails(context, item, source),
|
|
children: [
|
|
ItemSource(
|
|
sourceTitle: item.author ?? '',
|
|
sourceSubtitle: '${source.type.toLocalizedString()}: ${source.title}',
|
|
sourceType: source.type,
|
|
sourceIcon: source.icon,
|
|
itemPublishedAt: item.publishedAt,
|
|
itemIsRead: item.isRead,
|
|
),
|
|
ItemDescription(
|
|
itemDescription: item.description,
|
|
sourceFormat: DescriptionFormat.html,
|
|
tagetFormat: DescriptionFormat.markdown,
|
|
),
|
|
ItemMediaGallery(
|
|
itemMedias: item.options != null &&
|
|
item.options!.containsKey('media') &&
|
|
item.options!['media'] != null
|
|
? (item.options!['media'] as List)
|
|
.map((item) => item as String)
|
|
.toList()
|
|
: null,
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|