This commit is contained in:
		@@ -34,6 +34,7 @@ class MediaItem {
 | 
			
		||||
  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';
 | 
			
		||||
  String get postUrl => 'https://f0ck.me/$id';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class Tag {
 | 
			
		||||
 
 | 
			
		||||
@@ -82,12 +82,14 @@ class MediaProvider extends ChangeNotifier {
 | 
			
		||||
        tag: tag,
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
      addMediaItems(newMedia);
 | 
			
		||||
      if(_mediaItems != newMedia) {
 | 
			
		||||
        addMediaItems(newMedia);
 | 
			
		||||
        if (notify) notifyListeners();
 | 
			
		||||
      }
 | 
			
		||||
    } catch (e) {
 | 
			
		||||
      debugPrint('Fehler beim Laden der Medien: $e');
 | 
			
		||||
    } finally {
 | 
			
		||||
      _isLoading = false;
 | 
			
		||||
      if (notify) notifyListeners();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -33,8 +33,10 @@ class _MediaGridState extends State<MediaGrid> {
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  void scrollToTop() {
 | 
			
		||||
    _scrollController.jumpTo(0);
 | 
			
		||||
  int _calculateCrossAxisCount(BuildContext context, int defaultCount) {
 | 
			
		||||
    return defaultCount == 0
 | 
			
		||||
        ? (MediaQuery.of(context).size.width / 110).clamp(3, 5).toInt()
 | 
			
		||||
        : defaultCount;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
@@ -116,28 +118,36 @@ class _MediaGridState extends State<MediaGrid> {
 | 
			
		||||
          padding: EdgeInsets.zero,
 | 
			
		||||
          children: [
 | 
			
		||||
            DrawerHeader(
 | 
			
		||||
              padding: EdgeInsets.all(0),
 | 
			
		||||
              child: Image.asset('assets/images/menu.webp', fit: BoxFit.cover),
 | 
			
		||||
              decoration: BoxDecoration(
 | 
			
		||||
                image: DecorationImage(
 | 
			
		||||
                  image: AssetImage('assets/images/menu.webp'),
 | 
			
		||||
                  fit: BoxFit.cover,
 | 
			
		||||
                  alignment: Alignment.topCenter,
 | 
			
		||||
                ),
 | 
			
		||||
              ),
 | 
			
		||||
              child: null,
 | 
			
		||||
            ),
 | 
			
		||||
            ListTile(
 | 
			
		||||
              title: Text('v${AppVersion.version}'),
 | 
			
		||||
              onTap: () {
 | 
			
		||||
                ScaffoldMessenger.of(context).showSnackBar(
 | 
			
		||||
                  SnackBar(content: Text('jooong lass das, hier ist nichts')),
 | 
			
		||||
                );
 | 
			
		||||
              },
 | 
			
		||||
            ),
 | 
			
		||||
          ],
 | 
			
		||||
        ),
 | 
			
		||||
      ),
 | 
			
		||||
      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);
 | 
			
		||||
                      _scrollController.jumpTo(0);
 | 
			
		||||
                    },
 | 
			
		||||
                  ),
 | 
			
		||||
                ],
 | 
			
		||||
              InputChip(
 | 
			
		||||
                label: Text(provider.tag!),
 | 
			
		||||
                backgroundColor: const Color(0xFF090909),
 | 
			
		||||
                labelStyle: const TextStyle(color: Colors.white),
 | 
			
		||||
                onDeleted: () {
 | 
			
		||||
                  provider.setTag(null);
 | 
			
		||||
                  _scrollController.jumpTo(0);
 | 
			
		||||
                },
 | 
			
		||||
              ),
 | 
			
		||||
            ]
 | 
			
		||||
          : null,
 | 
			
		||||
@@ -152,11 +162,10 @@ class _MediaGridState extends State<MediaGrid> {
 | 
			
		||||
              key: PageStorageKey('mediaGrid'),
 | 
			
		||||
              controller: _scrollController,
 | 
			
		||||
              gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
 | 
			
		||||
                crossAxisCount: mediaProvider.crossAxisCount == 0
 | 
			
		||||
                    ? (MediaQuery.of(context).size.width / 110)
 | 
			
		||||
                          .clamp(3, 5)
 | 
			
		||||
                          .toInt()
 | 
			
		||||
                    : mediaProvider.crossAxisCount,
 | 
			
		||||
                crossAxisCount: _calculateCrossAxisCount(
 | 
			
		||||
                  context,
 | 
			
		||||
                  provider.crossAxisCount,
 | 
			
		||||
                ),
 | 
			
		||||
                crossAxisSpacing: 5.0,
 | 
			
		||||
                mainAxisSpacing: 5.0,
 | 
			
		||||
              ),
 | 
			
		||||
@@ -170,14 +179,15 @@ class _MediaGridState extends State<MediaGrid> {
 | 
			
		||||
 | 
			
		||||
                return InkWell(
 | 
			
		||||
                  onTap: () async {
 | 
			
		||||
                    bool test = await Navigator.push(
 | 
			
		||||
                    bool? ret = await Navigator.push(
 | 
			
		||||
                      context,
 | 
			
		||||
                      MaterialPageRoute(
 | 
			
		||||
                        builder: (context) => DetailView(initialItemId: item.id),
 | 
			
		||||
                        builder: (context) =>
 | 
			
		||||
                            DetailView(initialItemId: item.id),
 | 
			
		||||
                      ),
 | 
			
		||||
                    );
 | 
			
		||||
                    if (test) {
 | 
			
		||||
                      scrollToTop();
 | 
			
		||||
                    if (ret != null && ret) {
 | 
			
		||||
                      _scrollController.jumpTo(0);
 | 
			
		||||
                    }
 | 
			
		||||
                  },
 | 
			
		||||
                  child: Stack(
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,10 @@
 | 
			
		||||
 | 
			
		||||
#include "generated_plugin_registrant.h"
 | 
			
		||||
 | 
			
		||||
#include <url_launcher_linux/url_launcher_plugin.h>
 | 
			
		||||
 | 
			
		||||
void fl_register_plugins(FlPluginRegistry* registry) {
 | 
			
		||||
  g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
 | 
			
		||||
      fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
 | 
			
		||||
  url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
list(APPEND FLUTTER_PLUGIN_LIST
 | 
			
		||||
  url_launcher_linux
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
 | 
			
		||||
 
 | 
			
		||||
@@ -7,12 +7,14 @@ import Foundation
 | 
			
		||||
 | 
			
		||||
import package_info_plus
 | 
			
		||||
import path_provider_foundation
 | 
			
		||||
import share_plus
 | 
			
		||||
import sqflite_darwin
 | 
			
		||||
import video_player_avfoundation
 | 
			
		||||
 | 
			
		||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
 | 
			
		||||
  FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
 | 
			
		||||
  PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
 | 
			
		||||
  SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
 | 
			
		||||
  SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
 | 
			
		||||
  FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin"))
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								pubspec.lock
									
									
									
									
									
								
							
							
						
						
									
										64
									
								
								pubspec.lock
									
									
									
									
									
								
							@@ -73,6 +73,14 @@ packages:
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "1.19.1"
 | 
			
		||||
  cross_file:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: cross_file
 | 
			
		||||
      sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "0.3.4+2"
 | 
			
		||||
  crypto:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
@@ -256,6 +264,14 @@ packages:
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "1.16.0"
 | 
			
		||||
  mime:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: mime
 | 
			
		||||
      sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.0.0"
 | 
			
		||||
  nested:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
@@ -376,6 +392,22 @@ packages:
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "0.28.0"
 | 
			
		||||
  share_plus:
 | 
			
		||||
    dependency: "direct main"
 | 
			
		||||
    description:
 | 
			
		||||
      name: share_plus
 | 
			
		||||
      sha256: b2961506569e28948d75ec346c28775bb111986bb69dc6a20754a457e3d97fa0
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "11.0.0"
 | 
			
		||||
  share_plus_platform_interface:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: share_plus_platform_interface
 | 
			
		||||
      sha256: "1032d392bc5d2095a77447a805aa3f804d2ae6a4d5eef5e6ebb3bd94c1bc19ef"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "6.0.0"
 | 
			
		||||
  sky_engine:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description: flutter
 | 
			
		||||
@@ -493,6 +525,38 @@ packages:
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "1.4.0"
 | 
			
		||||
  url_launcher_linux:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: url_launcher_linux
 | 
			
		||||
      sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "3.2.1"
 | 
			
		||||
  url_launcher_platform_interface:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: url_launcher_platform_interface
 | 
			
		||||
      sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.3.2"
 | 
			
		||||
  url_launcher_web:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: url_launcher_web
 | 
			
		||||
      sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "2.4.1"
 | 
			
		||||
  url_launcher_windows:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
      name: url_launcher_windows
 | 
			
		||||
      sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77"
 | 
			
		||||
      url: "https://pub.dev"
 | 
			
		||||
    source: hosted
 | 
			
		||||
    version: "3.1.4"
 | 
			
		||||
  uuid:
 | 
			
		||||
    dependency: transitive
 | 
			
		||||
    description:
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 | 
			
		||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
 | 
			
		||||
# In Windows, build-name is used as the major, minor, and patch parts
 | 
			
		||||
# of the product and file versions while build-number is used as the build suffix.
 | 
			
		||||
version: 1.0.29+29
 | 
			
		||||
version: 1.1.0+30
 | 
			
		||||
 | 
			
		||||
environment:
 | 
			
		||||
  sdk: ^3.9.0-100.2.beta
 | 
			
		||||
@@ -39,6 +39,7 @@ dependencies:
 | 
			
		||||
  cached_video_player_plus: ^3.0.3
 | 
			
		||||
  provider: ^6.1.5
 | 
			
		||||
  package_info_plus: ^8.3.0
 | 
			
		||||
  share_plus: ^11.0.0
 | 
			
		||||
 | 
			
		||||
dev_dependencies:
 | 
			
		||||
  flutter_test:
 | 
			
		||||
 
 | 
			
		||||
@@ -6,6 +6,12 @@
 | 
			
		||||
 | 
			
		||||
#include "generated_plugin_registrant.h"
 | 
			
		||||
 | 
			
		||||
#include <share_plus/share_plus_windows_plugin_c_api.h>
 | 
			
		||||
#include <url_launcher_windows/url_launcher_windows.h>
 | 
			
		||||
 | 
			
		||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
 | 
			
		||||
  SharePlusWindowsPluginCApiRegisterWithRegistrar(
 | 
			
		||||
      registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
 | 
			
		||||
  UrlLauncherWindowsRegisterWithRegistrar(
 | 
			
		||||
      registry->GetRegistrarForPlugin("UrlLauncherWindows"));
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,8 @@
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
list(APPEND FLUTTER_PLUGIN_LIST
 | 
			
		||||
  share_plus
 | 
			
		||||
  url_launcher_windows
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user