From 405d388db07f9037902321b8e11eca53811dc2d3 Mon Sep 17 00:00:00 2001 From: Flummi Date: Mon, 23 Jun 2025 02:51:49 +0200 Subject: [PATCH] v1.4.6+67 --- lib/models/item.dart | 19 ++++- lib/screens/mediadetail.dart | 139 +++++++++++++++++++++-------------- lib/services/api.dart | 2 +- pubspec.yaml | 2 +- 4 files changed, 104 insertions(+), 58 deletions(-) diff --git a/lib/models/item.dart b/lib/models/item.dart index b2f8fe1..35bd162 100644 --- a/lib/models/item.dart +++ b/lib/models/item.dart @@ -7,6 +7,9 @@ class MediaItem { final int mode; final List? tags; final List? favorites; + final String? username; + final String? userchannel; + final String? usernetwork; MediaItem({ required this.id, @@ -17,6 +20,9 @@ class MediaItem { required this.mode, this.tags = const [], this.favorites = const [], + this.username, + this.userchannel, + this.usernetwork, }); String get thumbnailUrl => 'https://f0ck.me/t/$id.webp'; @@ -33,6 +39,9 @@ class MediaItem { int? mode, List? tags, List? favorites, + String? username, + String? userchannel, + String? usernetwork, }) { return MediaItem( id: id ?? this.id, @@ -43,6 +52,9 @@ class MediaItem { mode: mode ?? this.mode, tags: tags ?? this.tags, favorites: favorites ?? this.favorites, + username: username ?? this.username, + userchannel: userchannel ?? this.userchannel, + usernetwork: usernetwork ?? this.usernetwork, ); } @@ -64,6 +76,9 @@ class MediaItem { ?.map((e) => Favorite.fromJson(e)) .toList() ?? [], + username: json['username'], + userchannel: json['userchannel'], + usernetwork: json['usernetwork'], ); } } @@ -97,8 +112,8 @@ class Favorite { factory Favorite.fromJson(Map json) { return Favorite( - userId: json['user_id'], - username: json['user'], + userId: json['userId'], + username: json['username'], avatar: json['avatar'], ); } diff --git a/lib/screens/mediadetail.dart b/lib/screens/mediadetail.dart index afa1346..d24b970 100644 --- a/lib/screens/mediadetail.dart +++ b/lib/screens/mediadetail.dart @@ -305,64 +305,95 @@ class _MediaDetailScreenState extends State { () => PullexRefreshController(), ); - return PullexRefresh( - onRefresh: () => _onRefresh(item.id, refreshController), - header: const WaterDropHeader(), - controller: refreshController, - child: CustomScrollView( - controller: scrollController, - slivers: [ - SliverToBoxAdapter( - child: AnimatedBuilder( - animation: _pageController!, - builder: (context, child) { - return buildAnimatedTransition( - context: context, - pageController: _pageController!, - index: index, - child: child!, - ); - }, - child: Obx( - () => _buildMedia(item, index == _currentIndex.value), - ), - ), - ), - if (isReady) - SliverFillRemaining( - hasScrollBody: false, - fillOverscroll: true, - child: GestureDetector( - onTap: () => settingsController.hideVideoControls(), - behavior: HitTestBehavior.translucent, - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - TagSection(tags: item.tags ?? []), - Obx( - () => Visibility( - visible: authController.isLoggedIn, - child: Padding( - padding: const EdgeInsets.only(top: 20.0), - child: FavoriteSection( - item: item, - index: index, - ), - ), - ), - ), - ], + return Stack( + children: [ + PullexRefresh( + onRefresh: () => _onRefresh(item.id, refreshController), + header: const WaterDropHeader(), + controller: refreshController, + child: CustomScrollView( + controller: scrollController, + slivers: [ + SliverToBoxAdapter( + child: AnimatedBuilder( + animation: _pageController!, + builder: (context, child) { + return buildAnimatedTransition( + context: context, + pageController: _pageController!, + index: index, + child: child!, + ); + }, + child: Obx( + () => + _buildMedia(item, index == _currentIndex.value), ), ), ), - ), - const SliverToBoxAdapter( - child: SafeArea(child: SizedBox.shrink()), + if (isReady) + SliverFillRemaining( + hasScrollBody: false, + fillOverscroll: true, + child: GestureDetector( + onTap: () => settingsController.hideVideoControls(), + behavior: HitTestBehavior.translucent, + child: Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [TagSection(tags: item.tags ?? [])], + ), + ), + ), + ), + const SliverToBoxAdapter( + child: SafeArea(child: SizedBox.shrink()), + ), + ], ), - ], - ), + ), + Obx(() { + if (!authController.isLoggedIn) { + return const SizedBox.shrink(); + } + final MediaItem currentItem = + mediaController.items[_currentIndex.value]; + return DraggableScrollableSheet( + initialChildSize: 0.11, + minChildSize: 0.11, + maxChildSize: 0.245, + snap: true, + builder: (context, scrollController) => ListView( + controller: scrollController, + padding: const EdgeInsets.only(left: 16, right: 16), + children: [ + FavoriteSection( + item: currentItem, + index: _currentIndex.value, + ), + const SizedBox(height: 16), + Text( + "Dateigröße: ${(currentItem.size / 1024).toStringAsFixed(1)} KB", + style: Theme.of(context).textTheme.bodySmall, + ), + Text( + "Typ: ${currentItem.mime}", + style: Theme.of(context).textTheme.bodySmall, + ), + Text( + "ID: ${currentItem.id}", + style: Theme.of(context).textTheme.bodySmall, + ), + Text( + "Hochgeladen am: ${DateTime.fromMillisecondsSinceEpoch(currentItem.stamp * 1000)}", + style: Theme.of(context).textTheme.bodySmall, + ), + ], + ), + ); + }), + ], ); }, ), diff --git a/lib/services/api.dart b/lib/services/api.dart index 78529e0..9f56c44 100644 --- a/lib/services/api.dart +++ b/lib/services/api.dart @@ -31,7 +31,7 @@ class ApiService extends GetConnect { } final Response response = await get( - 'https://api.f0ck.me/items_new/get', + 'https://api.f0ck.me/items/get', query: params, headers: headers, ); diff --git a/pubspec.yaml b/pubspec.yaml index dfdc5c7..2f8e0cd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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.4.5+66 +version: 1.4.6+67 environment: sdk: ^3.9.0-100.2.beta