This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:f0ckapp/models/media_item.dart';
 | 
			
		||||
import 'package:f0ckapp/models/item.dart';
 | 
			
		||||
 | 
			
		||||
class ActionTag extends StatelessWidget {
 | 
			
		||||
  final Tag tag;
 | 
			
		||||
@@ -13,13 +13,7 @@ class ActionTag extends StatelessWidget {
 | 
			
		||||
    return GestureDetector(
 | 
			
		||||
      onTap: () => onTagTap(tag.tag),
 | 
			
		||||
      child:
 | 
			
		||||
          [
 | 
			
		||||
            'german',
 | 
			
		||||
            'dutch',
 | 
			
		||||
            'ukraine',
 | 
			
		||||
            'russia',
 | 
			
		||||
            'belgium',
 | 
			
		||||
          ].contains(tag.tag)
 | 
			
		||||
          ['german', 'dutch', 'ukraine', 'russia', 'belgium'].contains(tag.tag)
 | 
			
		||||
          ? Stack(
 | 
			
		||||
              alignment: Alignment.center,
 | 
			
		||||
              children: [
 | 
			
		||||
 
 | 
			
		||||
@@ -1,121 +0,0 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
import 'package:cached_network_image/cached_network_image.dart';
 | 
			
		||||
import 'package:get/get.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:f0ckapp/controller/media_controller.dart';
 | 
			
		||||
import 'package:f0ckapp/service/media_service.dart';
 | 
			
		||||
import 'package:f0ckapp/controller/auth_controller.dart';
 | 
			
		||||
import 'package:f0ckapp/widgets/actiontag.dart';
 | 
			
		||||
import 'package:f0ckapp/widgets/favorite_avatars.dart';
 | 
			
		||||
import 'package:f0ckapp/widgets/video_widget.dart';
 | 
			
		||||
import 'package:f0ckapp/models/media_item.dart';
 | 
			
		||||
 | 
			
		||||
class DetailMediaContent extends StatelessWidget {
 | 
			
		||||
  final int currentPage;
 | 
			
		||||
  final int index;
 | 
			
		||||
  final void Function(String tag) onTagTap;
 | 
			
		||||
 | 
			
		||||
  const DetailMediaContent({
 | 
			
		||||
    super.key,
 | 
			
		||||
    required this.currentPage,
 | 
			
		||||
    required this.index,
 | 
			
		||||
    required this.onTagTap,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
    final MediaService mediaService = Get.find();
 | 
			
		||||
    final MediaController controller = Get.find();
 | 
			
		||||
    final AuthController authController = Get.find();
 | 
			
		||||
 | 
			
		||||
    return SafeArea(
 | 
			
		||||
      top: false,
 | 
			
		||||
      child: SingleChildScrollView(
 | 
			
		||||
        child: Obx(() {
 | 
			
		||||
          final MediaItem currentItem = controller.mediaItems[index];
 | 
			
		||||
          final bool isFavorite =
 | 
			
		||||
              currentItem.favorites?.any(
 | 
			
		||||
                (f) => f.userId == authController.userId.value,
 | 
			
		||||
              ) ??
 | 
			
		||||
              false;
 | 
			
		||||
 | 
			
		||||
          return Column(
 | 
			
		||||
            children: [
 | 
			
		||||
              _buildMedia(currentItem, index == currentPage),
 | 
			
		||||
              const SizedBox(height: 10, width: double.infinity),
 | 
			
		||||
              _buildTags(currentItem),
 | 
			
		||||
              if (currentItem.favorites != null &&
 | 
			
		||||
                  authController.token.value != null) ...[
 | 
			
		||||
                const SizedBox(height: 20),
 | 
			
		||||
                _buildFavoritesRow(context, currentItem, isFavorite, () async {
 | 
			
		||||
                  final List<Favorite>? newFavorites = await mediaService
 | 
			
		||||
                      .toggleFavorite(currentItem, isFavorite);
 | 
			
		||||
                  if (newFavorites != null) {
 | 
			
		||||
                    controller.mediaItems[index] = currentItem.copyWith(
 | 
			
		||||
                      favorites: newFavorites,
 | 
			
		||||
                    );
 | 
			
		||||
                    controller.mediaItems.refresh();
 | 
			
		||||
                  }
 | 
			
		||||
                }),
 | 
			
		||||
              ],
 | 
			
		||||
              const SizedBox(height: 20),
 | 
			
		||||
            ],
 | 
			
		||||
          );
 | 
			
		||||
        }),
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Widget _buildMedia(MediaItem item, bool isActive) {
 | 
			
		||||
    if (item.mime.startsWith('image')) {
 | 
			
		||||
      return CachedNetworkImage(
 | 
			
		||||
        imageUrl: item.mediaUrl,
 | 
			
		||||
        fit: BoxFit.contain,
 | 
			
		||||
        placeholder: (context, url) =>
 | 
			
		||||
            const Center(child: CircularProgressIndicator()),
 | 
			
		||||
        errorWidget: (context, url, error) =>
 | 
			
		||||
            const Center(child: Icon(Icons.error)),
 | 
			
		||||
      );
 | 
			
		||||
    } else {
 | 
			
		||||
      return VideoWidget(details: item, isActive: isActive);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Widget _buildTags(MediaItem item) {
 | 
			
		||||
    return Wrap(
 | 
			
		||||
      alignment: WrapAlignment.center,
 | 
			
		||||
      spacing: 5.0,
 | 
			
		||||
      children: item.tags
 | 
			
		||||
          .map<Widget>((Tag tag) => ActionTag(tag, onTagTap))
 | 
			
		||||
          .toList(),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  Widget _buildFavoritesRow(
 | 
			
		||||
    BuildContext context,
 | 
			
		||||
    MediaItem item,
 | 
			
		||||
    bool isFavorite,
 | 
			
		||||
    VoidCallback onFavoritePressed,
 | 
			
		||||
  ) {
 | 
			
		||||
    return Row(
 | 
			
		||||
      children: [
 | 
			
		||||
        Expanded(
 | 
			
		||||
          child: SingleChildScrollView(
 | 
			
		||||
            scrollDirection: Axis.horizontal,
 | 
			
		||||
            child: FavoriteAvatars(
 | 
			
		||||
              favorites: item.favorites ?? [],
 | 
			
		||||
              brightness: Theme.of(context).brightness,
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
        ),
 | 
			
		||||
        IconButton(
 | 
			
		||||
          icon: isFavorite
 | 
			
		||||
              ? const Icon(Icons.favorite)
 | 
			
		||||
              : const Icon(Icons.favorite_outline),
 | 
			
		||||
          color: Colors.red,
 | 
			
		||||
          onPressed: onFavoritePressed,
 | 
			
		||||
        ),
 | 
			
		||||
      ],
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:get/get.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:f0ckapp/screens/login_screen.dart';
 | 
			
		||||
import 'package:f0ckapp/controller/auth_controller.dart';
 | 
			
		||||
import 'package:f0ckapp/screens/settings_screen.dart';
 | 
			
		||||
import 'package:f0ckapp/controller/theme_controller.dart';
 | 
			
		||||
import 'package:f0ckapp/controller/authcontroller.dart';
 | 
			
		||||
import 'package:f0ckapp/controller/themecontroller.dart';
 | 
			
		||||
import 'package:f0ckapp/screens/login.dart';
 | 
			
		||||
import 'package:f0ckapp/screens/settings.dart';
 | 
			
		||||
import 'package:f0ckapp/utils/appversion.dart';
 | 
			
		||||
 | 
			
		||||
class EndDrawer extends StatelessWidget {
 | 
			
		||||
@@ -89,7 +89,7 @@ class EndDrawer extends StatelessWidget {
 | 
			
		||||
                    ElevatedButton(
 | 
			
		||||
                      onPressed: () {
 | 
			
		||||
                        Navigator.pop(context);
 | 
			
		||||
                        Get.to(() => LoginPage());
 | 
			
		||||
                        Get.to(() => LoginScreen());
 | 
			
		||||
                      },
 | 
			
		||||
                      child: const Text('Login'),
 | 
			
		||||
                    ),
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:cached_network_image/cached_network_image.dart';
 | 
			
		||||
 | 
			
		||||
class FavoriteAvatars extends StatelessWidget {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,16 +2,12 @@ import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:get/get.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:f0ckapp/controller/media_controller.dart';
 | 
			
		||||
import 'package:f0ckapp/service/media_service.dart';
 | 
			
		||||
import 'package:f0ckapp/controller/mediacontroller.dart';
 | 
			
		||||
 | 
			
		||||
class FilterBar extends StatelessWidget {
 | 
			
		||||
  final ScrollController scrollController;
 | 
			
		||||
  
 | 
			
		||||
  const FilterBar({
 | 
			
		||||
    super.key,
 | 
			
		||||
    required this.scrollController,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  const FilterBar({super.key, required this.scrollController});
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
@@ -23,39 +19,43 @@ class FilterBar extends StatelessWidget {
 | 
			
		||||
        mainAxisAlignment: MainAxisAlignment.spaceAround,
 | 
			
		||||
        children: [
 | 
			
		||||
          const Text('type: '),
 | 
			
		||||
          Obx(() => DropdownButton<String>(
 | 
			
		||||
            value: mediaTypes[c.type.value],
 | 
			
		||||
            isDense: true,
 | 
			
		||||
            items: mediaTypes.map((String value) {
 | 
			
		||||
              return DropdownMenuItem<String>(
 | 
			
		||||
                value: value,
 | 
			
		||||
                child: Text(value),
 | 
			
		||||
              );
 | 
			
		||||
            }).toList(),
 | 
			
		||||
            onChanged: (String? newValue) {
 | 
			
		||||
              if (newValue != null) {
 | 
			
		||||
                c.setType(mediaTypes.indexOf(newValue));
 | 
			
		||||
                scrollController.jumpTo(0);
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
          )),
 | 
			
		||||
          Obx(
 | 
			
		||||
            () => DropdownButton<String>(
 | 
			
		||||
              value: mediaTypes[c.typeIndex.value],
 | 
			
		||||
              isDense: true,
 | 
			
		||||
              items: mediaTypes.map((String value) {
 | 
			
		||||
                return DropdownMenuItem<String>(
 | 
			
		||||
                  value: value,
 | 
			
		||||
                  child: Text(value),
 | 
			
		||||
                );
 | 
			
		||||
              }).toList(),
 | 
			
		||||
              onChanged: (String? newValue) {
 | 
			
		||||
                if (newValue != null) {
 | 
			
		||||
                  c.setTypeIndex(mediaTypes.indexOf(newValue));
 | 
			
		||||
                  scrollController.jumpTo(0);
 | 
			
		||||
                }
 | 
			
		||||
              },
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
          const Text('mode: '),
 | 
			
		||||
          Obx(() => DropdownButton<String>(
 | 
			
		||||
            value: mediaModes[c.mode.value],
 | 
			
		||||
            isDense: true,
 | 
			
		||||
            items: mediaModes.map((String value) {
 | 
			
		||||
              return DropdownMenuItem<String>(
 | 
			
		||||
                value: value,
 | 
			
		||||
                child: Text(value),
 | 
			
		||||
              );
 | 
			
		||||
            }).toList(),
 | 
			
		||||
            onChanged: (String? newValue) {
 | 
			
		||||
              if (newValue != null) {
 | 
			
		||||
                c.setMode(mediaModes.indexOf(newValue));
 | 
			
		||||
                scrollController.jumpTo(0);
 | 
			
		||||
              }
 | 
			
		||||
            },
 | 
			
		||||
          )),
 | 
			
		||||
          Obx(
 | 
			
		||||
            () => DropdownButton<String>(
 | 
			
		||||
              value: mediaModes[c.modeIndex.value],
 | 
			
		||||
              isDense: true,
 | 
			
		||||
              items: mediaModes.map((String value) {
 | 
			
		||||
                return DropdownMenuItem<String>(
 | 
			
		||||
                  value: value,
 | 
			
		||||
                  child: Text(value),
 | 
			
		||||
                );
 | 
			
		||||
              }).toList(),
 | 
			
		||||
              onChanged: (String? newValue) {
 | 
			
		||||
                if (newValue != null) {
 | 
			
		||||
                  c.setModeIndex(mediaModes.indexOf(newValue));
 | 
			
		||||
                  scrollController.jumpTo(0);
 | 
			
		||||
                }
 | 
			
		||||
              },
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
        ],
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
 
 | 
			
		||||
@@ -3,11 +3,10 @@ import 'package:flutter/material.dart';
 | 
			
		||||
import 'package:cached_network_image/cached_network_image.dart';
 | 
			
		||||
import 'package:get/get.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:f0ckapp/models/media_item.dart';
 | 
			
		||||
import 'package:f0ckapp/models/item.dart';
 | 
			
		||||
 | 
			
		||||
class MediaTile extends StatelessWidget {
 | 
			
		||||
  final MediaItem item;
 | 
			
		||||
 | 
			
		||||
  const MediaTile({super.key, required this.item});
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
@@ -20,14 +19,12 @@ class MediaTile extends StatelessWidget {
 | 
			
		||||
        child: Stack(
 | 
			
		||||
          fit: StackFit.expand,
 | 
			
		||||
          children: [
 | 
			
		||||
            Hero(
 | 
			
		||||
              tag: 'media-${item.id}',
 | 
			
		||||
              child: CachedNetworkImage(
 | 
			
		||||
                imageUrl: item.thumbnailUrl,
 | 
			
		||||
                fit: BoxFit.cover,
 | 
			
		||||
                placeholder: (content, url) => Container(color: Colors.grey[900]),
 | 
			
		||||
                errorWidget: (context, url, error) => const Icon(Icons.error),
 | 
			
		||||
              ),
 | 
			
		||||
            CachedNetworkImage(
 | 
			
		||||
              imageUrl: 'https://f0ck.me/t/${item.id}.webp',
 | 
			
		||||
              fit: BoxFit.cover,
 | 
			
		||||
              placeholder: (context, url) => Container(color: Colors.grey[900]),
 | 
			
		||||
              errorWidget: (context, url, error) =>
 | 
			
		||||
                  const Icon(Icons.broken_image),
 | 
			
		||||
            ),
 | 
			
		||||
            Align(
 | 
			
		||||
              alignment: Alignment.bottomRight,
 | 
			
		||||
 
 | 
			
		||||
@@ -1,75 +1,66 @@
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:cached_video_player_plus/cached_video_player_plus.dart';
 | 
			
		||||
import 'package:get/get.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:f0ckapp/controller/media_controller.dart';
 | 
			
		||||
 | 
			
		||||
class VideoControlsOverlay extends StatelessWidget {
 | 
			
		||||
  final CachedVideoPlayerPlusController controller;
 | 
			
		||||
  final VoidCallback button;
 | 
			
		||||
  final VoidCallback onOverlayTap;
 | 
			
		||||
  final bool muted;
 | 
			
		||||
  final VoidCallback onMuteToggle;
 | 
			
		||||
 | 
			
		||||
  const VideoControlsOverlay({
 | 
			
		||||
    super.key,
 | 
			
		||||
    required this.controller,
 | 
			
		||||
    required this.button,
 | 
			
		||||
    required this.onOverlayTap,
 | 
			
		||||
    required this.muted,
 | 
			
		||||
    required this.onMuteToggle,
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
    final MediaController c = Get.find<MediaController>();
 | 
			
		||||
 | 
			
		||||
    return Stack(
 | 
			
		||||
      alignment: Alignment.center,
 | 
			
		||||
      children: [
 | 
			
		||||
        Row(
 | 
			
		||||
          mainAxisAlignment: MainAxisAlignment.center,
 | 
			
		||||
          children: [
 | 
			
		||||
            _ControlButton(Icons.replay_10, () {
 | 
			
		||||
              onOverlayTap();
 | 
			
		||||
              Duration newPosition =
 | 
			
		||||
                  controller.value.position - const Duration(seconds: 10);
 | 
			
		||||
              if (newPosition < Duration.zero) newPosition = Duration.zero;
 | 
			
		||||
              controller.seekTo(newPosition);
 | 
			
		||||
            }),
 | 
			
		||||
            const SizedBox(width: 40),
 | 
			
		||||
            _ControlButton(
 | 
			
		||||
              controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
 | 
			
		||||
              () {
 | 
			
		||||
                onOverlayTap();
 | 
			
		||||
                controller.value.isPlaying
 | 
			
		||||
                    ? controller.pause()
 | 
			
		||||
                    : controller.play();
 | 
			
		||||
              },
 | 
			
		||||
              size: 64,
 | 
			
		||||
            ),
 | 
			
		||||
            const SizedBox(width: 40),
 | 
			
		||||
            _ControlButton(Icons.forward_10, () {
 | 
			
		||||
              onOverlayTap();
 | 
			
		||||
              Duration newPosition =
 | 
			
		||||
                  controller.value.position + const Duration(seconds: 10);
 | 
			
		||||
              if (newPosition > controller.value.duration) {
 | 
			
		||||
                newPosition = controller.value.duration;
 | 
			
		||||
              }
 | 
			
		||||
              controller.seekTo(newPosition);
 | 
			
		||||
            }),
 | 
			
		||||
          ],
 | 
			
		||||
        ),
 | 
			
		||||
        Positioned(
 | 
			
		||||
          right: 12,
 | 
			
		||||
          bottom: 12,
 | 
			
		||||
          child: Obx(
 | 
			
		||||
            () => _ControlButton(
 | 
			
		||||
              c.muted.value ? Icons.volume_off : Icons.volume_up,
 | 
			
		||||
              () async {
 | 
			
		||||
                button();
 | 
			
		||||
                await c.toggleMuted();
 | 
			
		||||
              },
 | 
			
		||||
              size: 16,
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
        ),
 | 
			
		||||
        Center(
 | 
			
		||||
          child: Row(
 | 
			
		||||
            mainAxisAlignment: MainAxisAlignment.center,
 | 
			
		||||
            children: [
 | 
			
		||||
              _ControlButton(Icons.replay_10, () {
 | 
			
		||||
                button();
 | 
			
		||||
                Duration newPosition =
 | 
			
		||||
                    controller.value.position - const Duration(seconds: 10);
 | 
			
		||||
                if (newPosition < Duration.zero) newPosition = Duration.zero;
 | 
			
		||||
                controller.seekTo(newPosition);
 | 
			
		||||
              }),
 | 
			
		||||
              SizedBox(width: 40),
 | 
			
		||||
              _ControlButton(
 | 
			
		||||
                controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
 | 
			
		||||
                () {
 | 
			
		||||
                  button();
 | 
			
		||||
                  controller.value.isPlaying
 | 
			
		||||
                      ? controller.pause()
 | 
			
		||||
                      : controller.play();
 | 
			
		||||
                },
 | 
			
		||||
                size: 64,
 | 
			
		||||
              ),
 | 
			
		||||
              SizedBox(width: 40),
 | 
			
		||||
              _ControlButton(Icons.forward_10, () {
 | 
			
		||||
                button();
 | 
			
		||||
                Duration newPosition =
 | 
			
		||||
                    controller.value.position + const Duration(seconds: 10);
 | 
			
		||||
                if (newPosition > controller.value.duration) {
 | 
			
		||||
                  newPosition = controller.value.duration;
 | 
			
		||||
                }
 | 
			
		||||
                controller.seekTo(newPosition);
 | 
			
		||||
              }),
 | 
			
		||||
            ],
 | 
			
		||||
          ),
 | 
			
		||||
          child: _ControlButton(muted ? Icons.volume_off : Icons.volume_up, () {
 | 
			
		||||
            onOverlayTap();
 | 
			
		||||
            onMuteToggle();
 | 
			
		||||
          }, size: 16),
 | 
			
		||||
        ),
 | 
			
		||||
        Align(
 | 
			
		||||
          alignment: Alignment.bottomCenter,
 | 
			
		||||
@@ -83,11 +74,12 @@ class VideoControlsOverlay extends StatelessWidget {
 | 
			
		||||
                  bottom: 12,
 | 
			
		||||
                  child: Text(
 | 
			
		||||
                    '${_formatDuration(controller.value.position)} / ${_formatDuration(controller.value.duration)}',
 | 
			
		||||
                    style: const TextStyle(color: Colors.white, fontSize: 12),
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
                Listener(
 | 
			
		||||
                  onPointerDown: (_) {
 | 
			
		||||
                    button();
 | 
			
		||||
                    onOverlayTap();
 | 
			
		||||
                  },
 | 
			
		||||
                  child: VideoProgressIndicator(
 | 
			
		||||
                    controller,
 | 
			
		||||
@@ -100,23 +92,24 @@ class VideoControlsOverlay extends StatelessWidget {
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
                Positioned(
 | 
			
		||||
                  left:
 | 
			
		||||
                      (controller.value.position.inMilliseconds /
 | 
			
		||||
                              controller.value.duration.inMilliseconds) *
 | 
			
		||||
                          MediaQuery.of(context).size.width -
 | 
			
		||||
                      6,
 | 
			
		||||
                  bottom: -4,
 | 
			
		||||
                  child: Container(
 | 
			
		||||
                    width: 12,
 | 
			
		||||
                    height: 12,
 | 
			
		||||
                    decoration: BoxDecoration(
 | 
			
		||||
                      shape: BoxShape.circle,
 | 
			
		||||
                      color: Colors.red,
 | 
			
		||||
                      border: Border.all(color: Colors.red, width: 2),
 | 
			
		||||
                if (controller.value.duration.inMilliseconds > 0)
 | 
			
		||||
                  Positioned(
 | 
			
		||||
                    left:
 | 
			
		||||
                        (controller.value.position.inMilliseconds /
 | 
			
		||||
                                controller.value.duration.inMilliseconds) *
 | 
			
		||||
                            MediaQuery.of(context).size.width -
 | 
			
		||||
                        6,
 | 
			
		||||
                    bottom: -4,
 | 
			
		||||
                    child: Container(
 | 
			
		||||
                      width: 12,
 | 
			
		||||
                      height: 12,
 | 
			
		||||
                      decoration: BoxDecoration(
 | 
			
		||||
                        shape: BoxShape.circle,
 | 
			
		||||
                        color: Colors.red,
 | 
			
		||||
                        border: Border.all(color: Colors.red, width: 2),
 | 
			
		||||
                      ),
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
              ],
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
@@ -1,14 +1,14 @@
 | 
			
		||||
import 'dart:async';
 | 
			
		||||
 | 
			
		||||
import 'package:cached_network_image/cached_network_image.dart';
 | 
			
		||||
import 'package:cached_video_player_plus/cached_video_player_plus.dart';
 | 
			
		||||
import 'package:flutter/material.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:get/get.dart';
 | 
			
		||||
import 'package:cached_video_player_plus/cached_video_player_plus.dart';
 | 
			
		||||
import 'package:cached_network_image/cached_network_image.dart';
 | 
			
		||||
 | 
			
		||||
import 'package:f0ckapp/controller/media_controller.dart';
 | 
			
		||||
import 'package:f0ckapp/models/media_item.dart';
 | 
			
		||||
import 'package:f0ckapp/widgets/videooverlay_widget.dart';
 | 
			
		||||
import 'package:f0ckapp/models/item.dart';
 | 
			
		||||
import 'package:f0ckapp/widgets/video_controls_overlay.dart';
 | 
			
		||||
import 'package:f0ckapp/controller/mediacontroller.dart';
 | 
			
		||||
 | 
			
		||||
class VideoWidget extends StatefulWidget {
 | 
			
		||||
  final MediaItem details;
 | 
			
		||||
@@ -44,15 +44,13 @@ class _VideoWidgetState extends State<VideoWidget> {
 | 
			
		||||
    );
 | 
			
		||||
    await _controller.initialize();
 | 
			
		||||
    setState(() {});
 | 
			
		||||
 | 
			
		||||
    _controller.addListener(() => setState(() {}));
 | 
			
		||||
    _controller.setLooping(true);
 | 
			
		||||
    _controller.setVolume(controller.muted.value ? 0.0 : 1.0);
 | 
			
		||||
 | 
			
		||||
    if (widget.isActive) {
 | 
			
		||||
      _controller.play();
 | 
			
		||||
    }
 | 
			
		||||
    _controller.setLooping(true);
 | 
			
		||||
 | 
			
		||||
    _controller.setVolume(controller.muted.value ? 0.0 : 1.0);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
@@ -96,34 +94,31 @@ class _VideoWidgetState extends State<VideoWidget> {
 | 
			
		||||
 | 
			
		||||
    bool isAudio = widget.details.mime.startsWith('audio');
 | 
			
		||||
 | 
			
		||||
    if (widget.fullScreen) {
 | 
			
		||||
      return Stack(
 | 
			
		||||
    Widget mediaContent;
 | 
			
		||||
    if (isAudio) {
 | 
			
		||||
      mediaContent = CachedNetworkImage(
 | 
			
		||||
        imageUrl: widget.details.coverUrl,
 | 
			
		||||
        fit: BoxFit.cover,
 | 
			
		||||
        errorWidget: (c, e, s) => Image.asset(
 | 
			
		||||
          'assets/images/music.webp',
 | 
			
		||||
          fit: BoxFit.contain,
 | 
			
		||||
          width: double.infinity,
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
    } else {
 | 
			
		||||
      mediaContent = _controller.value.isInitialized
 | 
			
		||||
          ? CachedVideoPlayerPlus(_controller)
 | 
			
		||||
          : const Center(child: CircularProgressIndicator());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return AspectRatio(
 | 
			
		||||
      aspectRatio: _controller.value.isInitialized
 | 
			
		||||
          ? _controller.value.aspectRatio
 | 
			
		||||
          : (isAudio ? 16 / 9 : 9 / 16),
 | 
			
		||||
      child: Stack(
 | 
			
		||||
        alignment: Alignment.center,
 | 
			
		||||
        children: [
 | 
			
		||||
          Center(
 | 
			
		||||
            child: AspectRatio(
 | 
			
		||||
              aspectRatio: _controller.value.isInitialized
 | 
			
		||||
                  ? _controller.value.aspectRatio
 | 
			
		||||
                  : 9 / 16,
 | 
			
		||||
              child: GestureDetector(
 | 
			
		||||
                onTap: _onTap,
 | 
			
		||||
                child: isAudio
 | 
			
		||||
                    ? CachedNetworkImage(
 | 
			
		||||
                        imageUrl: widget.details.coverUrl,
 | 
			
		||||
                        fit: BoxFit.cover,
 | 
			
		||||
                        placeholder: (context, url) =>
 | 
			
		||||
                            const CircularProgressIndicator(),
 | 
			
		||||
                        errorWidget: (context, url, error) => Image.asset(
 | 
			
		||||
                          'assets/images/music.webp',
 | 
			
		||||
                          fit: BoxFit.contain,
 | 
			
		||||
                          width: double.infinity,
 | 
			
		||||
                        ),
 | 
			
		||||
                      )
 | 
			
		||||
                    : _controller.value.isInitialized
 | 
			
		||||
                    ? CachedVideoPlayerPlus(_controller)
 | 
			
		||||
                    : const Center(child: CircularProgressIndicator()),
 | 
			
		||||
              ),
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
          GestureDetector(onTap: _onTap, child: mediaContent),
 | 
			
		||||
          if (_controller.value.isInitialized && _showControls)
 | 
			
		||||
            Positioned.fill(
 | 
			
		||||
              child: GestureDetector(
 | 
			
		||||
@@ -132,61 +127,18 @@ class _VideoWidgetState extends State<VideoWidget> {
 | 
			
		||||
                  color: Colors.black.withValues(alpha: 0.5),
 | 
			
		||||
                  child: VideoControlsOverlay(
 | 
			
		||||
                    controller: _controller,
 | 
			
		||||
                    button: () => _onTap(ctrlButton: true),
 | 
			
		||||
                    onOverlayTap: () => _onTap(ctrlButton: true),
 | 
			
		||||
                    muted: muted,
 | 
			
		||||
                    onMuteToggle: () {
 | 
			
		||||
                      controller.toggleMuted();
 | 
			
		||||
                      setState(() {});
 | 
			
		||||
                    },
 | 
			
		||||
                  ),
 | 
			
		||||
                ),
 | 
			
		||||
              ),
 | 
			
		||||
            ),
 | 
			
		||||
        ],
 | 
			
		||||
      );
 | 
			
		||||
    } else {
 | 
			
		||||
      return Column(
 | 
			
		||||
        mainAxisSize: MainAxisSize.min,
 | 
			
		||||
        children: [
 | 
			
		||||
          AspectRatio(
 | 
			
		||||
            aspectRatio: _controller.value.isInitialized
 | 
			
		||||
                ? _controller.value.aspectRatio
 | 
			
		||||
                : 9 / 16,
 | 
			
		||||
            child: Stack(
 | 
			
		||||
              alignment: Alignment.topCenter,
 | 
			
		||||
              children: [
 | 
			
		||||
                GestureDetector(
 | 
			
		||||
                  onTap: _onTap,
 | 
			
		||||
                  child: isAudio
 | 
			
		||||
                      ? CachedNetworkImage(
 | 
			
		||||
                          imageUrl: widget.details.coverUrl,
 | 
			
		||||
                          fit: BoxFit.cover,
 | 
			
		||||
                          placeholder: (context, url) =>
 | 
			
		||||
                              const CircularProgressIndicator(),
 | 
			
		||||
                          errorWidget: (context, url, error) => Image.asset(
 | 
			
		||||
                            'assets/images/music.webp',
 | 
			
		||||
                            fit: BoxFit.contain,
 | 
			
		||||
                            width: double.infinity,
 | 
			
		||||
                          ),
 | 
			
		||||
                        )
 | 
			
		||||
                      : _controller.value.isInitialized
 | 
			
		||||
                      ? CachedVideoPlayerPlus(_controller)
 | 
			
		||||
                      : const Center(child: CircularProgressIndicator()),
 | 
			
		||||
                ),
 | 
			
		||||
                if (_controller.value.isInitialized && _showControls) ...[
 | 
			
		||||
                  IgnorePointer(
 | 
			
		||||
                    ignoring: true,
 | 
			
		||||
                    child: Container(
 | 
			
		||||
                      color: Colors.black.withValues(alpha: 0.5),
 | 
			
		||||
                      width: double.infinity,
 | 
			
		||||
                      height: double.infinity,
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
                  VideoControlsOverlay(
 | 
			
		||||
                    controller: _controller,
 | 
			
		||||
                    button: () => _onTap(ctrlButton: true),
 | 
			
		||||
                  ),
 | 
			
		||||
                ],
 | 
			
		||||
              ],
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
        ],
 | 
			
		||||
      );
 | 
			
		||||
    }
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user