This commit is contained in:
@ -1,3 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@ -8,6 +10,7 @@ import 'package:f0ckapp/utils/SmartRefreshIndicator.dart';
|
||||
import 'package:f0ckapp/utils/PageTransformer.dart';
|
||||
import 'package:f0ckapp/providers/MediaProvider.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
class DetailView extends StatefulWidget {
|
||||
final int initialItemId;
|
||||
@ -95,7 +98,62 @@ class _DetailViewState extends State<DetailView> {
|
||||
final provider = Provider.of<MediaProvider>(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(centerTitle: true, title: const Text('f0ck')),
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
'f0ck #${provider.mediaItems.elementAt(_currentIndex).id.toString()}',
|
||||
),
|
||||
actions: [
|
||||
PopupMenuButton<String>(
|
||||
onSelected: (value) {
|
||||
final item = provider.mediaItems.elementAt(_currentIndex);
|
||||
switch (value) {
|
||||
case 'media':
|
||||
final params = ShareParams(
|
||||
files: [
|
||||
XFile.fromData(
|
||||
utf8.encode(item.mediaUrl),
|
||||
mimeType: item.mime,
|
||||
),
|
||||
],
|
||||
);
|
||||
SharePlus.instance.share(params);
|
||||
break;
|
||||
case 'direct_link':
|
||||
SharePlus.instance.share(ShareParams(text: item.mediaUrl));
|
||||
break;
|
||||
case 'post_link':
|
||||
SharePlus.instance.share(ShareParams(text: item.postUrl));
|
||||
break;
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
PopupMenuItem(
|
||||
value: 'media',
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.image),
|
||||
title: Text('Als Datei'),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'direct_link',
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.link),
|
||||
title: Text('Link zum Bild'),
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'post_link',
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.article),
|
||||
title: Text('Link zum Post'),
|
||||
),
|
||||
),
|
||||
],
|
||||
icon: Icon(Icons.share),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
PageTransformer(
|
||||
@ -115,20 +173,14 @@ class _DetailViewState extends State<DetailView> {
|
||||
),
|
||||
persistentFooterButtons: provider.tag != null
|
||||
? [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('tag: '),
|
||||
InputChip(
|
||||
label: Text(provider.tag!),
|
||||
backgroundColor: const Color(0xFF090909),
|
||||
labelStyle: const TextStyle(color: Colors.white),
|
||||
onDeleted: () {
|
||||
provider.setTag(null);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
InputChip(
|
||||
label: Text(provider.tag!),
|
||||
backgroundColor: const Color(0xFF090909),
|
||||
labelStyle: const TextStyle(color: Colors.white),
|
||||
onDeleted: () {
|
||||
provider.setTag(null);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
]
|
||||
: null,
|
||||
@ -150,11 +202,11 @@ class _DetailViewState extends State<DetailView> {
|
||||
)
|
||||
else
|
||||
VideoWidget(details: item, isActive: isActive),
|
||||
const SizedBox(height: 20),
|
||||
/*const SizedBox(height: 20),
|
||||
Text(
|
||||
'f0ck #${item.id.toString()}',
|
||||
style: const TextStyle(color: Colors.white, fontSize: 18),
|
||||
),
|
||||
),*/
|
||||
const SizedBox(height: 10, width: double.infinity),
|
||||
Wrap(
|
||||
alignment: WrapAlignment.center,
|
||||
|
Reference in New Issue
Block a user