Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
5e8983e347 | |||
93a89ba4b9 | |||
ba7505c2b3 | |||
39fadc009f | |||
0d42fad708 | |||
405d388db0 | |||
e30635304b | |||
7a1f76ee85 | |||
95f6dcfe2b | |||
7f0743808a | |||
840395bb69 |
@ -41,7 +41,7 @@ jobs:
|
||||
TAR_OPTIONS: --no-same-owner
|
||||
|
||||
- name: build apk
|
||||
run: flutter build apk --release
|
||||
run: flutter build apk --release --split-per-abi
|
||||
|
||||
- name: release-build
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
@ -49,7 +49,9 @@ jobs:
|
||||
NODE_OPTIONS: '--experimental-fetch'
|
||||
with:
|
||||
files: |-
|
||||
build/app/outputs/flutter-apk/app-release.apk
|
||||
build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
|
||||
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
|
||||
build/app/outputs/flutter-apk/app-x86_64-release.apk
|
||||
token: '${{secrets.RELEASE_TOKEN}}'
|
||||
|
||||
- name: upload apk to f-droid server
|
||||
@ -57,5 +59,5 @@ jobs:
|
||||
BUILD_NUMBER=$(grep '^version:' pubspec.yaml | sed 's/.*+//')
|
||||
curl -X POST "https://flumm.io/pullfdroid.php" \
|
||||
-F "token=${{ secrets.PULLER_TOKEN }}" \
|
||||
-F "apk=@build/app/outputs/flutter-apk/app-release.apk" \
|
||||
-F "apk=@build/app/outputs/flutter-apk/app-arm64-v8a-release.apk" \
|
||||
-F "build=$BUILD_NUMBER"
|
||||
|
27
.metadata
27
.metadata
@ -4,8 +4,8 @@
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: "8b18dde77fa59ba7f87540c05d1aba787198e77a"
|
||||
channel: "master"
|
||||
revision: "01fde956f0d13551843a44ae16eda7ca87478603"
|
||||
channel: "beta"
|
||||
|
||||
project_type: app
|
||||
|
||||
@ -13,27 +13,8 @@ project_type: app
|
||||
migration:
|
||||
platforms:
|
||||
- platform: root
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: android
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: ios
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: linux
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: macos
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: web
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
- platform: windows
|
||||
create_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
base_revision: 8b18dde77fa59ba7f87540c05d1aba787198e77a
|
||||
|
||||
create_revision: 01fde956f0d13551843a44ae16eda7ca87478603
|
||||
base_revision: 01fde956f0d13551843a44ae16eda7ca87478603
|
||||
# User provided section
|
||||
|
||||
# List of Local paths (relative to this file) that should be
|
||||
|
@ -1,5 +1,5 @@
|
||||
# fApp
|
||||

|
||||

|
||||
## Overview
|
||||
|
||||
fApp is the mobile application for the website [f0ck.me](https://f0ck.me). This app provides a user-friendly interface to access the content of the website and utilize its features conveniently from your mobile device.
|
||||
|
@ -2,7 +2,6 @@ import 'dart:convert';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:encrypt_shared_preferences/provider.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import 'package:f0ckapp/models/user.dart';
|
||||
|
||||
@ -10,6 +9,8 @@ class AuthController extends GetxController {
|
||||
final EncryptedSharedPreferencesAsync storage =
|
||||
EncryptedSharedPreferencesAsync.getInstance();
|
||||
|
||||
final GetConnect http = GetConnect();
|
||||
|
||||
RxnString token = RxnString();
|
||||
Rxn<User> user = Rxn<User>();
|
||||
RxBool isLoading = false.obs;
|
||||
@ -38,7 +39,8 @@ class AuthController extends GetxController {
|
||||
if (token.value != null) {
|
||||
try {
|
||||
await http.post(
|
||||
Uri.parse('https://api.f0ck.me/logout'),
|
||||
'https://api.f0ck.me/logout',
|
||||
{},
|
||||
headers: {
|
||||
'Authorization': 'Bearer ${token.value}',
|
||||
'Content-Type': 'application/json',
|
||||
@ -55,13 +57,15 @@ class AuthController extends GetxController {
|
||||
isLoading.value = true;
|
||||
error.value = null;
|
||||
try {
|
||||
final http.Response response = await http.post(
|
||||
Uri.parse('https://api.f0ck.me/login'),
|
||||
final Response<dynamic> response = await http.post(
|
||||
'https://api.f0ck.me/login',
|
||||
json.encode({'username': username, 'password': password}),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: json.encode({'username': username, 'password': password}),
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
final dynamic data = json.decode(response.body);
|
||||
final dynamic data = response.body is String
|
||||
? json.decode(response.body)
|
||||
: response.body;
|
||||
if (data['token'] != null) {
|
||||
await saveToken(data['token']);
|
||||
user.value = User.fromJson(data);
|
||||
@ -83,12 +87,14 @@ class AuthController extends GetxController {
|
||||
Future<void> fetchUserInfo() async {
|
||||
if (token.value == null) return;
|
||||
try {
|
||||
final http.Response response = await http.get(
|
||||
Uri.parse('https://api.f0ck.me/login/check'),
|
||||
final Response<dynamic> response = await http.get(
|
||||
'https://api.f0ck.me/login/check',
|
||||
headers: {'Authorization': 'Bearer ${token.value}'},
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
final dynamic data = json.decode(response.body);
|
||||
final dynamic data = response.body is String
|
||||
? json.decode(response.body)
|
||||
: response.body;
|
||||
user.value = User.fromJson(data);
|
||||
} else {
|
||||
await logout();
|
||||
|
@ -1,43 +1,32 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:encrypt_shared_preferences/provider.dart';
|
||||
|
||||
import 'package:f0ckapp/models/feed.dart';
|
||||
import 'package:f0ckapp/models/item.dart';
|
||||
import 'package:f0ckapp/services/api.dart';
|
||||
import 'package:f0ckapp/utils/animatedtransition.dart';
|
||||
|
||||
const List<String> mediaTypes = ["alles", "image", "video", "audio"];
|
||||
const List<String> mediaModes = ["sfw", "nsfw", "untagged", "all"];
|
||||
|
||||
class MediaController extends GetxController {
|
||||
final ApiService _api = Get.find<ApiService>();
|
||||
final EncryptedSharedPreferencesAsync storage =
|
||||
EncryptedSharedPreferencesAsync.getInstance();
|
||||
|
||||
RxList<MediaItem> items = <MediaItem>[].obs;
|
||||
RxBool loading = false.obs;
|
||||
RxBool atEnd = false.obs;
|
||||
RxBool atStart = false.obs;
|
||||
Rxn<String> errorMessage = Rxn<String>();
|
||||
|
||||
RxInt typeIndex = 0.obs;
|
||||
RxInt modeIndex = 0.obs;
|
||||
RxInt random = 0.obs;
|
||||
Rxn<String> tag = Rxn<String>(null);
|
||||
RxBool muted = false.obs;
|
||||
Rx<PageTransition> transitionType = PageTransition.opacity.obs;
|
||||
RxBool drawerSwipeEnabled = true.obs;
|
||||
RxInt crossAxisCount = 0.obs;
|
||||
RxInt videoControlsTimerNotifier = 0.obs;
|
||||
RxInt hideControlsNotifier = 0.obs;
|
||||
|
||||
void setTypeIndex(int idx) {
|
||||
typeIndex.value = idx;
|
||||
fetchInitial();
|
||||
}
|
||||
|
||||
void setModeIndex(int idx) {
|
||||
modeIndex.value = idx;
|
||||
fetchInitial();
|
||||
}
|
||||
|
||||
void setTag(String? newTag, {bool reload = true}) {
|
||||
@ -47,6 +36,10 @@ class MediaController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void toggleRandom() {
|
||||
random.value = random.value == 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
Future<List<Favorite>?> toggleFavorite(
|
||||
MediaItem item,
|
||||
bool isFavorite,
|
||||
@ -61,6 +54,7 @@ class MediaController extends GetxController {
|
||||
Future<Feed?> _fetchItems({int? older, int? newer}) async {
|
||||
if (loading.value) return null;
|
||||
loading.value = true;
|
||||
errorMessage.value = null;
|
||||
try {
|
||||
return await _api.fetchItems(
|
||||
older: older,
|
||||
@ -71,11 +65,10 @@ class MediaController extends GetxController {
|
||||
tag: tag.value,
|
||||
);
|
||||
} catch (e) {
|
||||
Get.snackbar(
|
||||
'Fehler beim Laden',
|
||||
'Die Daten konnten nicht abgerufen werden. Wo Internet?',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
final String errorText =
|
||||
'Die Daten konnten nicht abgerufen werden. Wo Internet?';
|
||||
errorMessage.value = errorText;
|
||||
Get.snackbar('Fehler beim Laden', errorText);
|
||||
return null;
|
||||
} finally {
|
||||
loading.value = false;
|
||||
@ -83,7 +76,7 @@ class MediaController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> fetchInitial({int? id}) async {
|
||||
final result = await _fetchItems(older: id);
|
||||
final Feed? result = await _fetchItems(older: id);
|
||||
if (result != null) {
|
||||
items.assignAll(result.items);
|
||||
atEnd.value = result.atEnd;
|
||||
@ -93,7 +86,7 @@ class MediaController extends GetxController {
|
||||
|
||||
Future<void> fetchMore() async {
|
||||
if (items.isEmpty || atEnd.value) return;
|
||||
final result = await _fetchItems(older: items.last.id);
|
||||
final Feed? result = await _fetchItems(older: items.last.id);
|
||||
if (result != null) {
|
||||
final Set<int> existingIds = items.map((e) => e.id).toSet();
|
||||
final List<MediaItem> newItems = result.items
|
||||
@ -105,10 +98,9 @@ class MediaController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
Future<int> fetchNewer() async {
|
||||
if (items.isEmpty || atStart.value) return 0;
|
||||
final oldLength = items.length;
|
||||
final result = await _fetchItems(newer: items.first.id);
|
||||
Future<void> fetchNewer() async {
|
||||
if (items.isEmpty || atStart.value) return;
|
||||
final Feed? result = await _fetchItems(newer: items.first.id);
|
||||
if (result != null) {
|
||||
final Set<int> existingIds = items.map((e) => e.id).toSet();
|
||||
final List<MediaItem> newItems = result.items
|
||||
@ -117,9 +109,8 @@ class MediaController extends GetxController {
|
||||
items.insertAll(0, newItems);
|
||||
items.refresh();
|
||||
atStart.value = result.atStart;
|
||||
return items.length - oldLength;
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
Future<void> handleRefresh() async {
|
||||
@ -132,63 +123,11 @@ class MediaController extends GetxController {
|
||||
}
|
||||
|
||||
Future<void> handleLoading() async {
|
||||
if (loading.value) return;
|
||||
if (!loading.value && !atEnd.value) {
|
||||
await fetchMore();
|
||||
}
|
||||
}
|
||||
|
||||
void toggleMuted() {
|
||||
muted.value = !muted.value;
|
||||
}
|
||||
|
||||
void setMuted(bool value) {
|
||||
muted.value = value;
|
||||
}
|
||||
|
||||
Future<void> setTransitionType(PageTransition type) async {
|
||||
transitionType.value = type;
|
||||
await saveSettings();
|
||||
}
|
||||
|
||||
Future<void> setCrossAxisCount(int value) async {
|
||||
crossAxisCount.value = value;
|
||||
await saveSettings();
|
||||
}
|
||||
|
||||
Future<void> setDrawerSwipeEnabled(bool enabled) async {
|
||||
drawerSwipeEnabled.value = enabled;
|
||||
await saveSettings();
|
||||
}
|
||||
|
||||
void toggleRandom() {
|
||||
random.value = random.value == 1 ? 0 : 1;
|
||||
fetchInitial();
|
||||
}
|
||||
|
||||
void resetVideoControlsTimer() => videoControlsTimerNotifier.value++;
|
||||
void hideVideoControls() => hideControlsNotifier.value++;
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
super.onInit();
|
||||
await loadSettings();
|
||||
}
|
||||
|
||||
Future<void> loadSettings() async {
|
||||
muted.value = await storage.getBoolean('muted') ?? false;
|
||||
crossAxisCount.value = await storage.getInt('crossAxisCount') ?? 0;
|
||||
drawerSwipeEnabled.value =
|
||||
await storage.getBoolean('drawerSwipeEnabled') ?? true;
|
||||
transitionType.value =
|
||||
PageTransition.values[await storage.getInt('transitionType') ?? 0];
|
||||
}
|
||||
|
||||
Future<void> saveSettings() async {
|
||||
await storage.setBoolean('muted', muted.value);
|
||||
await storage.setInt('crossAxisCount', crossAxisCount.value);
|
||||
await storage.setBoolean('drawerSwipeEnabled', drawerSwipeEnabled.value);
|
||||
await storage.setInt('transitionType', transitionType.value.index);
|
||||
}
|
||||
|
||||
bool get isRandomEnabled => random.value == 1;
|
||||
}
|
||||
|
75
lib/controller/settingscontroller.dart
Normal file
75
lib/controller/settingscontroller.dart
Normal file
@ -0,0 +1,75 @@
|
||||
import 'package:encrypt_shared_preferences/provider.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:f0ckapp/utils/animatedtransition.dart';
|
||||
|
||||
class _StorageKeys {
|
||||
static const String muted = 'muted';
|
||||
static const String crossAxisCount = 'crossAxisCount';
|
||||
static const String drawerSwipeEnabled = 'drawerSwipeEnabled';
|
||||
static const String transitionType = 'transitionType';
|
||||
}
|
||||
|
||||
class SettingsController extends GetxController {
|
||||
final EncryptedSharedPreferencesAsync storage =
|
||||
EncryptedSharedPreferencesAsync.getInstance();
|
||||
|
||||
RxBool muted = false.obs;
|
||||
Rx<PageTransition> transitionType = PageTransition.opacity.obs;
|
||||
RxBool drawerSwipeEnabled = true.obs;
|
||||
RxInt crossAxisCount = 0.obs;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
void toggleMuted() {
|
||||
muted.value = !muted.value;
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
void setMuted(bool value) {
|
||||
muted.value = value;
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
Future<void> setTransitionType(PageTransition type) async {
|
||||
transitionType.value = type;
|
||||
await saveSettings();
|
||||
}
|
||||
|
||||
Future<void> setCrossAxisCount(int value) async {
|
||||
crossAxisCount.value = value;
|
||||
await saveSettings();
|
||||
}
|
||||
|
||||
Future<void> setDrawerSwipeEnabled(bool enabled) async {
|
||||
drawerSwipeEnabled.value = enabled;
|
||||
await saveSettings();
|
||||
}
|
||||
|
||||
Future<void> loadSettings() async {
|
||||
muted.value = await storage.getBoolean(_StorageKeys.muted) ?? false;
|
||||
crossAxisCount.value =
|
||||
await storage.getInt(_StorageKeys.crossAxisCount) ?? 0;
|
||||
drawerSwipeEnabled.value =
|
||||
await storage.getBoolean(_StorageKeys.drawerSwipeEnabled) ?? true;
|
||||
transitionType.value = PageTransition
|
||||
.values[await storage.getInt(_StorageKeys.transitionType) ?? 0];
|
||||
}
|
||||
|
||||
Future<void> saveSettings() async {
|
||||
await storage.setBoolean(_StorageKeys.muted, muted.value);
|
||||
await storage.setInt(_StorageKeys.crossAxisCount, crossAxisCount.value);
|
||||
await storage.setBoolean(
|
||||
_StorageKeys.drawerSwipeEnabled,
|
||||
drawerSwipeEnabled.value,
|
||||
);
|
||||
await storage.setInt(
|
||||
_StorageKeys.transitionType,
|
||||
transitionType.value.index,
|
||||
);
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import 'package:encrypt_shared_preferences/provider.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:f0ckapp/services/api.dart';
|
||||
import 'package:f0ckapp/controller/settingscontroller.dart';
|
||||
import 'package:f0ckapp/controller/authcontroller.dart';
|
||||
import 'package:f0ckapp/controller/localizationcontroller.dart';
|
||||
import 'package:f0ckapp/controller/themecontroller.dart';
|
||||
@ -24,6 +25,7 @@ void main() async {
|
||||
|
||||
Get.put(AuthController());
|
||||
Get.put(ApiService());
|
||||
Get.put(SettingsController());
|
||||
Get.put(MediaController());
|
||||
|
||||
final ThemeController themeController = Get.put(ThemeController());
|
||||
|
@ -7,6 +7,9 @@ class MediaItem {
|
||||
final int mode;
|
||||
final List<Tag>? tags;
|
||||
final List<Favorite>? 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<Tag>? tags,
|
||||
List<Favorite>? 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<String, dynamic> json) {
|
||||
return Favorite(
|
||||
userId: json['user_id'],
|
||||
username: json['user'],
|
||||
userId: json['userId'],
|
||||
username: json['username'],
|
||||
avatar: json['avatar'],
|
||||
);
|
||||
}
|
||||
|
@ -8,14 +8,21 @@ import 'package:f0ckapp/widgets/video_widget.dart';
|
||||
|
||||
class FullScreenMediaView extends StatefulWidget {
|
||||
final MediaItem item;
|
||||
final Duration? initialPosition;
|
||||
|
||||
const FullScreenMediaView({super.key, required this.item});
|
||||
const FullScreenMediaView({
|
||||
super.key,
|
||||
required this.item,
|
||||
this.initialPosition,
|
||||
});
|
||||
|
||||
@override
|
||||
State createState() => _FullScreenMediaViewState();
|
||||
}
|
||||
|
||||
class _FullScreenMediaViewState extends State<FullScreenMediaView> {
|
||||
final GlobalKey<VideoWidgetState> _videoKey = GlobalKey<VideoWidgetState>();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -30,9 +37,21 @@ class _FullScreenMediaViewState extends State<FullScreenMediaView> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _popWithPosition() {
|
||||
Duration? currentPosition;
|
||||
if (widget.item.mime.startsWith('video') && _videoKey.currentState != null) {
|
||||
currentPosition = _videoKey.currentState!.videoController.value.position;
|
||||
}
|
||||
Navigator.of(context).pop(currentPosition);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return PopScope(
|
||||
onPopInvokedWithResult: (bool didPop, Object? result) async {
|
||||
return _popWithPosition();
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: Stack(
|
||||
children: [
|
||||
@ -52,9 +71,11 @@ class _FullScreenMediaViewState extends State<FullScreenMediaView> {
|
||||
)
|
||||
: Center(
|
||||
child: VideoWidget(
|
||||
key: _videoKey,
|
||||
details: widget.item,
|
||||
isActive: true,
|
||||
fullScreen: true,
|
||||
initialPosition: widget.initialPosition,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -63,12 +84,13 @@ class _FullScreenMediaViewState extends State<FullScreenMediaView> {
|
||||
alignment: Alignment.topLeft,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
onPressed: _popWithPosition,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -5,17 +5,21 @@ import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter_cache_manager/file.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pullex/pullex.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
|
||||
import 'package:f0ckapp/services/api.dart';
|
||||
import 'package:f0ckapp/widgets/tagfooter.dart';
|
||||
import 'package:f0ckapp/utils/animatedtransition.dart';
|
||||
import 'package:f0ckapp/controller/authcontroller.dart';
|
||||
import 'package:f0ckapp/widgets/actiontag.dart';
|
||||
import 'package:f0ckapp/widgets/favoritesection.dart';
|
||||
import 'package:f0ckapp/screens/fullscreen.dart';
|
||||
import 'package:f0ckapp/widgets/end_drawer.dart';
|
||||
import 'package:f0ckapp/controller/settingscontroller.dart';
|
||||
import 'package:f0ckapp/controller/mediacontroller.dart';
|
||||
import 'package:f0ckapp/models/item.dart';
|
||||
import 'package:f0ckapp/widgets/tagsection.dart';
|
||||
import 'package:f0ckapp/widgets/video_widget.dart';
|
||||
|
||||
enum ShareAction { media, directLink, postLink }
|
||||
@ -31,14 +35,17 @@ class MediaDetailScreen extends StatefulWidget {
|
||||
class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
||||
PageController? _pageController;
|
||||
final MediaController mediaController = Get.find<MediaController>();
|
||||
final SettingsController settingsController = Get.find<SettingsController>();
|
||||
final AuthController authController = Get.find<AuthController>();
|
||||
final RxInt _currentIndex = 0.obs;
|
||||
final MethodChannel _mediaSaverChannel = const MethodChannel('MediaShit');
|
||||
final Map<int, bool> _expandedTags = {};
|
||||
final Map<int, PullexRefreshController> _refreshControllers = {};
|
||||
final Map<int, GlobalKey<VideoWidgetState>> _videoWidgetKeys = {};
|
||||
|
||||
bool _isLoading = true;
|
||||
bool _itemNotFound = false;
|
||||
final Set<int> _readyItemIds = {};
|
||||
final RxSet<int> _readyItemIds = <int>{}.obs;
|
||||
final Rxn<int> _animatingFavoriteId = Rxn<int>();
|
||||
|
||||
final List<PopupMenuEntry<ShareAction>> _shareMenuItems = const [
|
||||
PopupMenuItem(
|
||||
@ -61,6 +68,7 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
timeago.setLocaleMessages('de', timeago.DeMessages());
|
||||
_loadInitialItem();
|
||||
}
|
||||
|
||||
@ -103,14 +111,51 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
||||
..snackbar('hehe', message, snackPosition: SnackPosition.BOTTOM);
|
||||
}
|
||||
|
||||
Future<void> _onRefresh(
|
||||
int itemId,
|
||||
PullexRefreshController controller,
|
||||
) async {
|
||||
if (mediaController.loading.value) {
|
||||
controller.refreshCompleted();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
final MediaItem item = await ApiService().fetchItemById(itemId);
|
||||
final int index = mediaController.items.indexWhere(
|
||||
(item) => item.id == itemId,
|
||||
);
|
||||
if (index != -1) {
|
||||
mediaController.items[index] = item;
|
||||
mediaController.items.refresh();
|
||||
}
|
||||
controller.refreshCompleted();
|
||||
} catch (e) {
|
||||
_showMsg('Fehler beim Aktualisieren: $e');
|
||||
controller.refreshFailed();
|
||||
}
|
||||
}
|
||||
|
||||
void _onPageChanged(int idx) {
|
||||
if (idx != _currentIndex.value) {
|
||||
_currentIndex.value = idx;
|
||||
final MediaItem item = mediaController.items[idx];
|
||||
if (item.mime.startsWith('image/') && !_readyItemIds.contains(item.id)) {
|
||||
setState(() => _readyItemIds.add(item.id));
|
||||
_readyItemIds.add(item.id);
|
||||
}
|
||||
}
|
||||
|
||||
if (idx + 1 < mediaController.items.length) {
|
||||
DefaultCacheManager().downloadFile(
|
||||
mediaController.items[idx + 1].mediaUrl,
|
||||
);
|
||||
}
|
||||
if (idx - 1 >= 0) {
|
||||
DefaultCacheManager().downloadFile(
|
||||
mediaController.items[idx - 1].mediaUrl,
|
||||
);
|
||||
}
|
||||
|
||||
if (idx >= mediaController.items.length - 2 &&
|
||||
!mediaController.loading.value &&
|
||||
!mediaController.atEnd.value) {
|
||||
@ -148,7 +193,7 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
||||
item.mediaUrl,
|
||||
);
|
||||
final Uint8List bytes = await file.readAsBytes();
|
||||
final params = ShareParams(
|
||||
final ShareParams params = ShareParams(
|
||||
files: [XFile.fromData(bytes, mimeType: item.mime)],
|
||||
);
|
||||
await SharePlus.instance.share(params);
|
||||
@ -172,115 +217,234 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _handleFullScreen(MediaItem currentItem) async {
|
||||
if (currentItem.mime.startsWith('image')) {
|
||||
Get.to(
|
||||
() => FullScreenMediaView(item: currentItem),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final GlobalKey<VideoWidgetState>? key = _videoWidgetKeys[currentItem.id];
|
||||
final VideoWidgetState? videoState = key?.currentState;
|
||||
if (videoState == null || !videoState.videoController.value.isInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Duration position = videoState.videoController.value.position;
|
||||
await videoState.videoController.pause();
|
||||
|
||||
final Duration? newPosition = await Get.to<Duration?>(
|
||||
() => FullScreenMediaView(item: currentItem, initialPosition: position),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
|
||||
if (mounted && videoState.mounted) {
|
||||
if (newPosition != null) {
|
||||
await videoState.videoController.seekTo(newPosition);
|
||||
}
|
||||
await videoState.videoController.play();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_pageController?.dispose();
|
||||
for (PullexRefreshController controller in _refreshControllers.values) {
|
||||
controller.dispose();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _handleFavoriteToggle(MediaItem item, bool isFavorite) async {
|
||||
if (!authController.isLoggedIn) return;
|
||||
HapticFeedback.lightImpact();
|
||||
|
||||
final List<Favorite>? newFavorites = await mediaController.toggleFavorite(
|
||||
item,
|
||||
isFavorite,
|
||||
);
|
||||
|
||||
final int index = mediaController.items.indexWhere((i) => i.id == item.id);
|
||||
|
||||
if (newFavorites != null && index != -1) {
|
||||
mediaController.items[index] = item.copyWith(favorites: newFavorites);
|
||||
mediaController.items.refresh();
|
||||
}
|
||||
|
||||
_animatingFavoriteId.value = item.id;
|
||||
Future.delayed(const Duration(milliseconds: 700), () {
|
||||
if (_animatingFavoriteId.value == item.id) {
|
||||
_animatingFavoriteId.value = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildMedia(MediaItem item, bool isActive) {
|
||||
Widget mediaWidget;
|
||||
final bool isFavorite =
|
||||
item.favorites?.any((f) => f.userId == authController.user.value?.id) ??
|
||||
false;
|
||||
|
||||
if (item.mime.startsWith('image/')) {
|
||||
return CachedNetworkImage(
|
||||
mediaWidget = CachedNetworkImage(
|
||||
imageUrl: item.mediaUrl,
|
||||
fit: BoxFit.contain,
|
||||
placeholder: (context, url) =>
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
errorWidget: (c, e, s) => const Icon(Icons.broken_image, size: 100),
|
||||
);
|
||||
} else if (item.mime.startsWith('video/') ||
|
||||
item.mime.startsWith('audio/')) {
|
||||
return VideoWidget(
|
||||
final GlobalKey<VideoWidgetState> key = _videoWidgetKeys.putIfAbsent(
|
||||
item.id,
|
||||
() => GlobalKey<VideoWidgetState>(),
|
||||
);
|
||||
mediaWidget = VideoWidget(
|
||||
key: key,
|
||||
details: item,
|
||||
isActive: isActive,
|
||||
onInitialized: () {
|
||||
if (mounted && !_readyItemIds.contains(item.id)) {
|
||||
setState(() => _readyItemIds.add(item.id));
|
||||
_readyItemIds.add(item.id);
|
||||
}
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return const Icon(Icons.help_outline, size: 100);
|
||||
}
|
||||
mediaWidget = const Icon(Icons.help_outline, size: 100);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_isLoading) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text('Lade f0ck #${widget.initialId}...')),
|
||||
body: const Center(child: CircularProgressIndicator()),
|
||||
return Hero(
|
||||
tag: 'media_${item.id}',
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onDoubleTap: () => _handleFavoriteToggle(item, isFavorite),
|
||||
child: mediaWidget,
|
||||
),
|
||||
Obx(() {
|
||||
final showAnimation = _animatingFavoriteId.value == item.id;
|
||||
return AnimatedOpacity(
|
||||
opacity: showAnimation ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: AnimatedScale(
|
||||
scale: showAnimation ? 1.0 : 0.5,
|
||||
duration: const Duration(milliseconds: 400),
|
||||
curve: Curves.easeOutBack,
|
||||
child: Icon(
|
||||
isFavorite ? Icons.favorite : Icons.favorite_outline,
|
||||
color: Colors.red,
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
PreferredSizeWidget _buildAppBar(BuildContext context) {
|
||||
return AppBar(
|
||||
title: Obx(() {
|
||||
if (_isLoading) {
|
||||
return Text('Lade f0ck #${widget.initialId}...');
|
||||
}
|
||||
if (_itemNotFound ||
|
||||
mediaController.items.isEmpty ||
|
||||
_currentIndex.value >= mediaController.items.length) {
|
||||
return const Text('Fehler');
|
||||
}
|
||||
final MediaItem currentItem =
|
||||
mediaController.items[_currentIndex.value];
|
||||
return Text('f0ck #${currentItem.id}');
|
||||
}),
|
||||
actions: [
|
||||
Obx(() {
|
||||
final bool showActions =
|
||||
!_isLoading &&
|
||||
!_itemNotFound &&
|
||||
mediaController.items.isNotEmpty &&
|
||||
_currentIndex.value < mediaController.items.length;
|
||||
|
||||
if (!showActions) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final MediaItem currentItem =
|
||||
mediaController.items[_currentIndex.value];
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.fullscreen),
|
||||
onPressed: () => _handleFullScreen(currentItem),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.download),
|
||||
onPressed: () async => await _downloadMedia(currentItem),
|
||||
),
|
||||
PopupMenuButton<ShareAction>(
|
||||
onSelected: (value) => _handleShareAction(value, currentItem),
|
||||
itemBuilder: (context) => _shareMenuItems,
|
||||
icon: const Icon(Icons.share),
|
||||
),
|
||||
],
|
||||
);
|
||||
}),
|
||||
Builder(
|
||||
builder: (context) => IconButton(
|
||||
icon: const Icon(Icons.menu),
|
||||
onPressed: () => Scaffold.of(context).openEndDrawer(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody(BuildContext context) {
|
||||
if (_isLoading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (_itemNotFound) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Fehler')),
|
||||
body: const Center(child: Text('f0ck nicht gefunden.')),
|
||||
);
|
||||
return const Center(child: Text('f0ck nicht gefunden.'));
|
||||
}
|
||||
|
||||
return Obx(
|
||||
() => PageView.builder(
|
||||
return Obx(() {
|
||||
if (mediaController.items.isEmpty) {
|
||||
return const Center(child: Text('Keine Items zum Anzeigen.'));
|
||||
}
|
||||
|
||||
return PageView.builder(
|
||||
controller: _pageController!,
|
||||
itemCount: mediaController.items.length,
|
||||
onPageChanged: _onPageChanged,
|
||||
itemBuilder: (context, index) {
|
||||
if (index >= mediaController.items.length) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final MediaItem item = mediaController.items[index];
|
||||
final bool isReady = _readyItemIds.contains(item.id);
|
||||
final bool areTagsExpanded = _expandedTags[item.id] ?? false;
|
||||
final List<Tag> allTags = item.tags ?? [];
|
||||
final bool hasMoreTags = allTags.length > 5;
|
||||
final List<Tag> tagsToShow = areTagsExpanded
|
||||
? allTags
|
||||
: allTags.take(5).toList();
|
||||
final PullexRefreshController refreshController = _refreshControllers
|
||||
.putIfAbsent(item.id, () => PullexRefreshController());
|
||||
|
||||
return Obx(
|
||||
() => Scaffold(
|
||||
endDrawer: EndDrawer(),
|
||||
endDrawerEnableOpenDragGesture:
|
||||
mediaController.drawerSwipeEnabled.value,
|
||||
appBar: AppBar(
|
||||
title: Text('f0ck #${item.id}'),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.fullscreen),
|
||||
onPressed: () {
|
||||
Get.to(
|
||||
FullScreenMediaView(item: item),
|
||||
fullscreenDialog: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.download),
|
||||
onPressed: () async {
|
||||
await _downloadMedia(item);
|
||||
},
|
||||
),
|
||||
PopupMenuButton<ShareAction>(
|
||||
onSelected: (value) => _handleShareAction(value, item),
|
||||
itemBuilder: (context) => _shareMenuItems,
|
||||
icon: const Icon(Icons.share),
|
||||
),
|
||||
Builder(
|
||||
builder: (context) => IconButton(
|
||||
icon: const Icon(Icons.menu),
|
||||
onPressed: () {
|
||||
Scaffold.of(context).openEndDrawer();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
AnimatedBuilder(
|
||||
return Obx(() {
|
||||
final bool isReady = _readyItemIds.contains(item.id);
|
||||
return PullexRefresh(
|
||||
onRefresh: () => _onRefresh(item.id, refreshController),
|
||||
header: const WaterDropHeader(),
|
||||
controller: refreshController,
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: AnimatedBuilder(
|
||||
animation: _pageController!,
|
||||
builder: (context, child) {
|
||||
return buildAnimatedTransition(
|
||||
context: context,
|
||||
pageController: _pageController!,
|
||||
index: index,
|
||||
controller: mediaController,
|
||||
child: child!,
|
||||
);
|
||||
},
|
||||
@ -288,81 +452,75 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
||||
() => _buildMedia(item, index == _currentIndex.value),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => mediaController.hideVideoControls(),
|
||||
behavior: HitTestBehavior.translucent,
|
||||
child: Visibility(
|
||||
visible: isReady,
|
||||
child: SingleChildScrollView(
|
||||
),
|
||||
if (isReady)
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Wrap(
|
||||
spacing: 6.0,
|
||||
runSpacing: 4.0,
|
||||
alignment: WrapAlignment.center,
|
||||
TagSection(tags: item.tags ?? []),
|
||||
Obx(() {
|
||||
if (!authController.isLoggedIn) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
final TextStyle? infoTextStyle = Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 24.0),
|
||||
child: Column(
|
||||
children: [
|
||||
...tagsToShow.map(
|
||||
(tag) => ActionTag(
|
||||
tag,
|
||||
(tag.tag == 'sfw' || tag.tag == 'nsfw')
|
||||
? (onTagTap) => {}
|
||||
: (onTagTap) {
|
||||
mediaController.setTag(
|
||||
onTagTap,
|
||||
FavoriteSection(item: item, index: index),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
"Dateigröße: ${(item.size / 1024).toStringAsFixed(1)} KB",
|
||||
style: infoTextStyle,
|
||||
),
|
||||
Text(
|
||||
"Typ: ${item.mime}",
|
||||
style: infoTextStyle,
|
||||
),
|
||||
Text(
|
||||
"ID: ${item.id}",
|
||||
style: infoTextStyle,
|
||||
),
|
||||
Text(
|
||||
"Hochgeladen: ${timeago.format(DateTime.fromMillisecondsSinceEpoch(item.stamp * 1000), locale: 'de')}",
|
||||
style: infoTextStyle,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
Get.offAllNamed('/');
|
||||
},
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SliverToBoxAdapter(
|
||||
child: SafeArea(child: SizedBox.shrink()),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (hasMoreTags)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
setState(
|
||||
() => _expandedTags[item.id] =
|
||||
!areTagsExpanded,
|
||||
);
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
areTagsExpanded
|
||||
? 'Weniger anzeigen'
|
||||
: 'Alle ${allTags.length} Tags anzeigen',
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => Visibility(
|
||||
visible: authController.isLoggedIn,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 20.0),
|
||||
child: FavoriteSection(
|
||||
item: item,
|
||||
index: index,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SafeArea(child: SizedBox.shrink()),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
endDrawer: const EndDrawer(),
|
||||
endDrawerEnableOpenDragGesture:
|
||||
settingsController.drawerSwipeEnabled.value,
|
||||
appBar: _buildAppBar(context),
|
||||
body: _buildBody(context),
|
||||
persistentFooterButtons: mediaController.tag.value != null
|
||||
? [TagFooter()]
|
||||
: null,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,13 @@ import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pullex/pullex.dart';
|
||||
|
||||
import 'package:f0ckapp/models/item.dart';
|
||||
import 'package:f0ckapp/widgets/tagfooter.dart';
|
||||
import 'package:f0ckapp/utils/customsearchdelegate.dart';
|
||||
import 'package:f0ckapp/widgets/end_drawer.dart';
|
||||
import 'package:f0ckapp/widgets/filter_bar.dart';
|
||||
import 'package:f0ckapp/widgets/media_tile.dart';
|
||||
import 'package:f0ckapp/controller/settingscontroller.dart';
|
||||
import 'package:f0ckapp/controller/mediacontroller.dart';
|
||||
|
||||
class MediaGrid extends StatefulWidget {
|
||||
@ -20,27 +22,46 @@ class MediaGrid extends StatefulWidget {
|
||||
class _MediaGrid extends State<MediaGrid> {
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
final MediaController _mediaController = Get.put(MediaController());
|
||||
final SettingsController _settingsController = Get.put(SettingsController());
|
||||
final PullexRefreshController _refreshController = PullexRefreshController(
|
||||
initialRefresh: false,
|
||||
);
|
||||
|
||||
late final _MediaGridAppBar _appBar;
|
||||
late final _MediaGridBody _body;
|
||||
Worker? _filterWorker;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_mediaController.fetchInitial();
|
||||
|
||||
_filterWorker = everAll(
|
||||
[
|
||||
_mediaController.typeIndex,
|
||||
_mediaController.modeIndex,
|
||||
_mediaController.tag,
|
||||
_mediaController.random,
|
||||
],
|
||||
(_) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_refreshController.requestRefresh();
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
_appBar = _MediaGridAppBar(mediaController: _mediaController);
|
||||
_body = _MediaGridBody(
|
||||
refreshController: _refreshController,
|
||||
mediaController: _mediaController,
|
||||
settingsController: _settingsController,
|
||||
scrollController: _scrollController,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_filterWorker?.dispose();
|
||||
_scrollController.dispose();
|
||||
_refreshController.dispose();
|
||||
super.dispose();
|
||||
@ -48,19 +69,55 @@ class _MediaGrid extends State<MediaGrid> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(
|
||||
() => Scaffold(
|
||||
return Obx(() {
|
||||
if (_mediaController.loading.value && _mediaController.items.isEmpty) {
|
||||
return Scaffold(
|
||||
appBar: _appBar,
|
||||
body: const Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
}
|
||||
|
||||
if (_mediaController.errorMessage.value != null &&
|
||||
_mediaController.items.isEmpty) {
|
||||
return Scaffold(
|
||||
appBar: _appBar,
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.error_outline, color: Colors.red, size: 60),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'${_mediaController.errorMessage.value}',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () => _mediaController.fetchInitial(),
|
||||
child: const Text('Erneut versuchen'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
endDrawer: const EndDrawer(),
|
||||
endDrawerEnableOpenDragGesture:
|
||||
_mediaController.drawerSwipeEnabled.value,
|
||||
bottomNavigationBar: FilterBar(scrollController: _scrollController),
|
||||
_settingsController.drawerSwipeEnabled.value,
|
||||
bottomNavigationBar: FilterBar(),
|
||||
appBar: _appBar,
|
||||
body: _body,
|
||||
persistentFooterButtons: _mediaController.tag.value != null
|
||||
? [TagFooter()]
|
||||
: null,
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +131,9 @@ class _MediaGridAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
return AppBar(
|
||||
title: InkWell(
|
||||
onTap: () {
|
||||
if (mediaController.tag.value != null) {
|
||||
mediaController.setTag(null);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@ -102,7 +161,9 @@ class _MediaGridAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
? Icons.shuffle_on_outlined
|
||||
: Icons.shuffle,
|
||||
),
|
||||
onPressed: mediaController.toggleRandom,
|
||||
onPressed: () {
|
||||
mediaController.toggleRandom();
|
||||
},
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
@ -121,20 +182,37 @@ class _MediaGridBody extends StatelessWidget {
|
||||
const _MediaGridBody({
|
||||
required this.refreshController,
|
||||
required this.mediaController,
|
||||
required this.settingsController,
|
||||
required this.scrollController,
|
||||
});
|
||||
|
||||
final PullexRefreshController refreshController;
|
||||
final MediaController mediaController;
|
||||
final SettingsController settingsController;
|
||||
final ScrollController scrollController;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PullexRefresh(
|
||||
if (mediaController.items.isEmpty && !mediaController.loading.value) {
|
||||
return const Center(
|
||||
child: Text(
|
||||
'Keine f0cks gefunden.\n\nVersuch mal andere Filter.',
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
return NotificationListener<ScrollNotification>(
|
||||
onNotification: (scrollInfo) {
|
||||
if (!mediaController.loading.value &&
|
||||
!mediaController.atEnd.value &&
|
||||
scrollInfo.metrics.pixels >=
|
||||
scrollInfo.metrics.maxScrollExtent - 600) {
|
||||
mediaController.handleLoading();
|
||||
}
|
||||
return true;
|
||||
},
|
||||
child: PullexRefresh(
|
||||
controller: refreshController,
|
||||
enablePullDown: true,
|
||||
enablePullUp: true,
|
||||
header: const MaterialHeader(),
|
||||
onRefresh: () async {
|
||||
try {
|
||||
await mediaController.handleRefresh();
|
||||
@ -142,22 +220,16 @@ class _MediaGridBody extends StatelessWidget {
|
||||
refreshController.refreshCompleted();
|
||||
}
|
||||
},
|
||||
onLoading: () async {
|
||||
try {
|
||||
await mediaController.handleLoading();
|
||||
} finally {
|
||||
refreshController.loadComplete();
|
||||
}
|
||||
},
|
||||
header: const WaterDropHeader(),
|
||||
child: Obx(
|
||||
() => GridView.builder(
|
||||
addAutomaticKeepAlives: false,
|
||||
controller: scrollController,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.all(4),
|
||||
itemCount: mediaController.items.length,
|
||||
gridDelegate: mediaController.crossAxisCount.value == 0
|
||||
gridDelegate: settingsController.crossAxisCount.value == 0
|
||||
? const SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: 150,
|
||||
crossAxisSpacing: 5,
|
||||
@ -165,21 +237,28 @@ class _MediaGridBody extends StatelessWidget {
|
||||
childAspectRatio: 1,
|
||||
)
|
||||
: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: mediaController.crossAxisCount.value,
|
||||
crossAxisCount: settingsController.crossAxisCount.value,
|
||||
crossAxisSpacing: 5,
|
||||
mainAxisSpacing: 5,
|
||||
childAspectRatio: 1,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
final item = mediaController.items[index];
|
||||
return GestureDetector(
|
||||
final MediaItem item = mediaController.items[index];
|
||||
return Hero(
|
||||
tag: 'media_${item.id}',
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: GestureDetector(
|
||||
key: ValueKey(item.id),
|
||||
onTap: () => Get.toNamed('/${item.id}'),
|
||||
child: MediaTile(item: item),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:f0ckapp/controller/localizationcontroller.dart';
|
||||
import 'package:f0ckapp/controller/mediacontroller.dart';
|
||||
import 'package:f0ckapp/controller/settingscontroller.dart';
|
||||
import 'package:f0ckapp/utils/animatedtransition.dart';
|
||||
|
||||
class SettingsPage extends StatefulWidget {
|
||||
@ -15,8 +15,8 @@ class SettingsPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SettingsPageState extends State<SettingsPage> {
|
||||
final MediaController controller = Get.find();
|
||||
final LocalizationController localizationController = Get.find();
|
||||
final SettingsController settingsController = Get.find<SettingsController>();
|
||||
final LocalizationController localizationController = Get.find<LocalizationController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -34,7 +34,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
title: Text('settings_numberofcolumns_title'.tr),
|
||||
trailing: Obx(
|
||||
() => DropdownButton<int>(
|
||||
value: controller.crossAxisCount.value,
|
||||
value: settingsController.crossAxisCount.value,
|
||||
dropdownColor: const Color.fromARGB(255, 43, 43, 43),
|
||||
iconEnabledColor: Colors.white,
|
||||
items: [0, 3, 4, 5].map((int value) {
|
||||
@ -51,7 +51,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
}).toList(),
|
||||
onChanged: (int? newValue) async {
|
||||
if (newValue != null) {
|
||||
await controller.setCrossAxisCount(newValue);
|
||||
await settingsController.setCrossAxisCount(newValue);
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -62,7 +62,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
title: Text('settings_pageanimation_title'.tr),
|
||||
trailing: Obx(
|
||||
() => DropdownButton<PageTransition>(
|
||||
value: controller.transitionType.value,
|
||||
value: settingsController.transitionType.value,
|
||||
dropdownColor: const Color.fromARGB(255, 43, 43, 43),
|
||||
iconEnabledColor: Colors.white,
|
||||
items: PageTransition.values.map((PageTransition type) {
|
||||
@ -91,7 +91,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
}).toList(),
|
||||
onChanged: (PageTransition? newValue) async {
|
||||
if (newValue != null) {
|
||||
await controller.setTransitionType(newValue);
|
||||
await settingsController.setTransitionType(newValue);
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -102,9 +102,9 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
SwitchListTile(
|
||||
title: Text('settings_drawer_title'.tr),
|
||||
subtitle: Text('settings_drawer_subtitle'.tr),
|
||||
value: controller.drawerSwipeEnabled.value,
|
||||
value: settingsController.drawerSwipeEnabled.value,
|
||||
onChanged: (bool value) async {
|
||||
await controller.setDrawerSwipeEnabled(value);
|
||||
await settingsController.setDrawerSwipeEnabled(value);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
|
@ -1,12 +1,11 @@
|
||||
import 'package:encrypt_shared_preferences/provider.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:f0ckapp/controller/authcontroller.dart';
|
||||
import 'package:f0ckapp/models/item.dart';
|
||||
import 'package:f0ckapp/models/feed.dart';
|
||||
|
||||
class ApiService extends GetConnect {
|
||||
final EncryptedSharedPreferencesAsync storage =
|
||||
EncryptedSharedPreferencesAsync.getInstance();
|
||||
final AuthController _authController = Get.find<AuthController>();
|
||||
|
||||
Future<Feed> fetchItems({
|
||||
int? older,
|
||||
@ -16,7 +15,7 @@ class ApiService extends GetConnect {
|
||||
int random = 0,
|
||||
String? tag,
|
||||
}) async {
|
||||
String? token = await storage.getString('token');
|
||||
String? token = _authController.token.value;
|
||||
final params = <String, String>{
|
||||
'type': type.toString(),
|
||||
'mode': mode.toString(),
|
||||
@ -32,7 +31,7 @@ class ApiService extends GetConnect {
|
||||
}
|
||||
|
||||
final Response<dynamic> response = await get(
|
||||
'https://api.f0ck.me/items_new/get',
|
||||
'https://api.f0ck.me/items/get',
|
||||
query: params,
|
||||
headers: headers,
|
||||
);
|
||||
@ -42,18 +41,40 @@ class ApiService extends GetConnect {
|
||||
feed.items.sort((a, b) => b.id.compareTo(a.id));
|
||||
return feed;
|
||||
} else {
|
||||
if (Get.isSnackbarOpen == false) {
|
||||
if (!Get.isSnackbarOpen) {
|
||||
Get.snackbar('Fehler', 'Fehler beim Laden der Items');
|
||||
}
|
||||
throw Exception('Fehler beim Laden der Items');
|
||||
}
|
||||
}
|
||||
|
||||
Future<MediaItem> fetchItemById(int itemId) async {
|
||||
String? token = _authController.token.value;
|
||||
final Map<String, String> headers = <String, String>{};
|
||||
if (token != null && token.isNotEmpty) {
|
||||
headers['Authorization'] = 'Bearer $token';
|
||||
}
|
||||
|
||||
final Response<dynamic> response = await get(
|
||||
'https://api.f0ck.me/item/$itemId',
|
||||
headers: headers,
|
||||
);
|
||||
|
||||
if (response.status.code == 200 && response.body is Map<String, dynamic>) {
|
||||
return MediaItem.fromJson(response.body as Map<String, dynamic>);
|
||||
} else {
|
||||
if (!Get.isSnackbarOpen) {
|
||||
Get.snackbar('Fehler', 'Fehler beim Laden des Items');
|
||||
}
|
||||
throw Exception('Fehler beim Laden des Items');
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<Favorite>?> toggleFavorite(
|
||||
MediaItem item,
|
||||
bool isFavorite,
|
||||
) async {
|
||||
String? token = await storage.getString('token');
|
||||
String? token = _authController.token.value;
|
||||
if (token == null || token.isEmpty) return null;
|
||||
|
||||
final Map<String, String> headers = {
|
||||
|
@ -1,6 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:f0ckapp/controller/mediacontroller.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:f0ckapp/controller/settingscontroller.dart';
|
||||
|
||||
enum PageTransition { opacity, scale, slide, rotate, flip }
|
||||
|
||||
@ -9,17 +11,17 @@ Widget buildAnimatedTransition({
|
||||
required Widget child,
|
||||
required PageController pageController,
|
||||
required int index,
|
||||
required MediaController controller,
|
||||
}) {
|
||||
final SettingsController settingsController = Get.find<SettingsController>();
|
||||
final double value = pageController.position.haveDimensions
|
||||
? pageController.page! - index
|
||||
: 0;
|
||||
|
||||
switch (controller.transitionType.value) {
|
||||
switch (settingsController.transitionType.value) {
|
||||
case PageTransition.opacity:
|
||||
return Opacity(
|
||||
opacity: Curves.easeOut.transform(1 - value.abs().clamp(0.0, 1.0)),
|
||||
child: Transform(transform: Matrix4.identity(), child: child),
|
||||
child: child,
|
||||
);
|
||||
case PageTransition.scale:
|
||||
return Transform.scale(
|
||||
@ -29,10 +31,7 @@ Widget buildAnimatedTransition({
|
||||
child: child,
|
||||
);
|
||||
case PageTransition.slide:
|
||||
return Transform.translate(
|
||||
offset: Offset(300 * value.abs(), 0),
|
||||
child: child,
|
||||
);
|
||||
return child;
|
||||
case PageTransition.rotate:
|
||||
return Opacity(
|
||||
opacity: (1 - value.abs()).clamp(0.0, 1.0),
|
||||
|
@ -4,13 +4,13 @@ import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import 'package:f0ckapp/controller/mediacontroller.dart';
|
||||
import 'package:f0ckapp/models/suggestion.dart';
|
||||
|
||||
class CustomSearchDelegate extends SearchDelegate<String> {
|
||||
final MediaController controller = Get.find<MediaController>();
|
||||
final GetConnect http = GetConnect();
|
||||
Timer? _debounceTimer;
|
||||
List<Suggestion>? _suggestions;
|
||||
bool _isLoading = false;
|
||||
@ -48,14 +48,16 @@ class CustomSearchDelegate extends SearchDelegate<String> {
|
||||
}
|
||||
|
||||
Future<List<Suggestion>> fetchSuggestions(String query) async {
|
||||
final Uri uri = Uri.parse('https://api.f0ck.me/search/?q=$query');
|
||||
final String url = 'https://api.f0ck.me/search/?q=$query';
|
||||
try {
|
||||
final http.Response response = await http
|
||||
.get(uri)
|
||||
final Response<dynamic> response = await http
|
||||
.get(url)
|
||||
.timeout(const Duration(seconds: 5));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final dynamic decoded = jsonDecode(response.body);
|
||||
final dynamic decoded = response.body is String
|
||||
? jsonDecode(response.body)
|
||||
: response.body;
|
||||
if (decoded is List) {
|
||||
final suggestions = decoded
|
||||
.map((item) => Suggestion.fromJson(item as Map<String, dynamic>))
|
||||
@ -66,7 +68,9 @@ class CustomSearchDelegate extends SearchDelegate<String> {
|
||||
throw Exception('Unerwartetes Format: Es wurde eine Liste erwartet.');
|
||||
}
|
||||
} else if (response.statusCode == 400) {
|
||||
final dynamic error = jsonDecode(response.body);
|
||||
final dynamic error = response.body is String
|
||||
? jsonDecode(response.body)
|
||||
: response.body;
|
||||
final String message = error is Map<String, dynamic>
|
||||
? error['detail']?.toString() ?? 'Unbekannter Fehler.'
|
||||
: 'Unbekannter Fehler.';
|
||||
|
@ -5,9 +5,7 @@ import 'package:get/get.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});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -32,7 +30,6 @@ class FilterBar extends StatelessWidget {
|
||||
onChanged: (String? newValue) {
|
||||
if (newValue != null) {
|
||||
c.setTypeIndex(mediaTypes.indexOf(newValue));
|
||||
scrollController.jumpTo(0);
|
||||
}
|
||||
},
|
||||
),
|
||||
@ -51,7 +48,6 @@ class FilterBar extends StatelessWidget {
|
||||
onChanged: (String? newValue) {
|
||||
if (newValue != null) {
|
||||
c.setModeIndex(mediaModes.indexOf(newValue));
|
||||
scrollController.jumpTo(0);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
@ -16,7 +16,7 @@ class MediaTile extends StatelessWidget {
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
CachedNetworkImage(
|
||||
imageUrl: 'https://f0ck.me/t/${item.id}.webp',
|
||||
imageUrl: item.thumbnailUrl,
|
||||
fit: BoxFit.cover,
|
||||
placeholder: (context, url) => Container(color: Colors.grey[900]),
|
||||
errorWidget: (context, url, error) =>
|
||||
|
62
lib/widgets/tagsection.dart
Normal file
62
lib/widgets/tagsection.dart
Normal file
@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:f0ckapp/models/item.dart';
|
||||
import 'package:f0ckapp/widgets/actiontag.dart';
|
||||
import 'package:f0ckapp/controller/mediacontroller.dart';
|
||||
|
||||
class TagSection extends StatefulWidget {
|
||||
final List<Tag> tags;
|
||||
const TagSection({super.key, required this.tags});
|
||||
|
||||
@override
|
||||
State<TagSection> createState() => _TagSectionState();
|
||||
}
|
||||
|
||||
class _TagSectionState extends State<TagSection> {
|
||||
bool _areTagsExpanded = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final MediaController mediaController = Get.find<MediaController>();
|
||||
final bool hasMoreTags = widget.tags.length > 5;
|
||||
final List<Tag> tagsToShow = _areTagsExpanded
|
||||
? widget.tags
|
||||
: widget.tags.take(5).toList();
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Wrap(
|
||||
spacing: 6.0,
|
||||
runSpacing: 4.0,
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
...tagsToShow.map(
|
||||
(tag) => ActionTag(
|
||||
tag,
|
||||
(tag.tag == 'sfw' || tag.tag == 'nsfw')
|
||||
? (onTagTap) => {}
|
||||
: (onTagTap) {
|
||||
mediaController.setTag(onTagTap);
|
||||
Get.offAllNamed('/');
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (hasMoreTags)
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
setState(() => _areTagsExpanded = !_areTagsExpanded);
|
||||
},
|
||||
child: Text(
|
||||
_areTagsExpanded
|
||||
? 'Weniger anzeigen'
|
||||
: 'Alle ${widget.tags.length} Tags anzeigen',
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -3,19 +3,16 @@ import 'dart:async';
|
||||
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/settingscontroller.dart';
|
||||
|
||||
class VideoControlsOverlay extends StatefulWidget {
|
||||
final CachedVideoPlayerPlusController controller;
|
||||
final VoidCallback onOverlayTap;
|
||||
final bool muted;
|
||||
final VoidCallback onMuteToggle;
|
||||
|
||||
const VideoControlsOverlay({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.onOverlayTap,
|
||||
required this.muted,
|
||||
required this.onMuteToggle,
|
||||
});
|
||||
|
||||
@override
|
||||
@ -23,156 +20,98 @@ class VideoControlsOverlay extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _VideoControlsOverlayState extends State<VideoControlsOverlay> {
|
||||
bool _showSeekIndicator = false;
|
||||
bool _isRewinding = false;
|
||||
final SettingsController _settingsController = Get.find();
|
||||
Timer? _hideTimer;
|
||||
bool _controlsVisible = false;
|
||||
|
||||
bool _isScrubbing = false;
|
||||
Duration _scrubbingStartPosition = Duration.zero;
|
||||
double _scrubbingStartDx = 0.0;
|
||||
Duration _scrubbingSeekPosition = Duration.zero;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.controller.addListener(_listener);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_hideTimer?.cancel();
|
||||
widget.controller.removeListener(_listener);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _handleDoubleTap(TapDownDetails details) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
final isRewind = details.globalPosition.dx < screenWidth / 2;
|
||||
|
||||
Future(() {
|
||||
if (isRewind) {
|
||||
final newPosition =
|
||||
widget.controller.value.position - const Duration(seconds: 10);
|
||||
widget.controller.seekTo(
|
||||
newPosition < Duration.zero ? Duration.zero : newPosition,
|
||||
);
|
||||
} else {
|
||||
final newPosition =
|
||||
widget.controller.value.position + const Duration(seconds: 10);
|
||||
final duration = widget.controller.value.duration;
|
||||
widget.controller.seekTo(
|
||||
newPosition > duration ? duration : newPosition,
|
||||
);
|
||||
void _listener() {
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
void _startHideTimer() {
|
||||
_hideTimer?.cancel();
|
||||
setState(() {
|
||||
_showSeekIndicator = true;
|
||||
_isRewinding = isRewind;
|
||||
});
|
||||
_hideTimer = Timer(const Duration(milliseconds: 500), () {
|
||||
setState(() => _showSeekIndicator = false);
|
||||
_hideTimer = Timer(const Duration(seconds: 5), () {
|
||||
if (mounted) {
|
||||
setState(() => _controlsVisible = false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: widget.onOverlayTap,
|
||||
onDoubleTapDown: _handleDoubleTap,
|
||||
child: Container(color: Colors.transparent),
|
||||
),
|
||||
AnimatedOpacity(
|
||||
opacity: _showSeekIndicator ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: Align(
|
||||
alignment: _isRewinding
|
||||
? Alignment.centerLeft
|
||||
: Alignment.centerRight,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 40.0),
|
||||
child: Icon(
|
||||
_isRewinding
|
||||
? Icons.fast_rewind_rounded
|
||||
: Icons.fast_forward_rounded,
|
||||
color: Colors.white70,
|
||||
size: 60,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
_ControlButton(
|
||||
widget.controller.value.isPlaying ? Icons.pause : Icons.play_arrow,
|
||||
() {
|
||||
widget.onOverlayTap();
|
||||
void _toggleControlsVisibility() {
|
||||
setState(() => _controlsVisible = !_controlsVisible);
|
||||
if (_controlsVisible) {
|
||||
_startHideTimer();
|
||||
}
|
||||
}
|
||||
|
||||
void _handlePlayPause() {
|
||||
widget.controller.value.isPlaying
|
||||
? widget.controller.pause()
|
||||
: widget.controller.play();
|
||||
},
|
||||
size: 64,
|
||||
),
|
||||
Positioned(
|
||||
right: 12,
|
||||
bottom: 12,
|
||||
child: _ControlButton(
|
||||
widget.muted ? Icons.volume_off : Icons.volume_up,
|
||||
() {
|
||||
widget.onOverlayTap();
|
||||
widget.onMuteToggle();
|
||||
},
|
||||
size: 16,
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 0),
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned(
|
||||
left: 10,
|
||||
bottom: 12,
|
||||
child: Text(
|
||||
'${_formatDuration(widget.controller.value.position)} / ${_formatDuration(widget.controller.value.duration)}',
|
||||
style: const TextStyle(color: Colors.white, fontSize: 12),
|
||||
),
|
||||
),
|
||||
Listener(
|
||||
onPointerDown: (_) {
|
||||
widget.onOverlayTap();
|
||||
},
|
||||
child: VideoProgressIndicator(
|
||||
widget.controller,
|
||||
allowScrubbing: true,
|
||||
padding: const EdgeInsets.only(top: 25.0),
|
||||
colors: const VideoProgressColors(
|
||||
playedColor: Colors.red,
|
||||
backgroundColor: Colors.grey,
|
||||
bufferedColor: Colors.white54,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.controller.value.duration.inMilliseconds > 0)
|
||||
Positioned(
|
||||
left:
|
||||
(widget.controller.value.position.inMilliseconds /
|
||||
widget
|
||||
.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),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
_startHideTimer();
|
||||
}
|
||||
|
||||
void _onHorizontalDragStart(DragStartDetails details) {
|
||||
if (!widget.controller.value.isInitialized || !_controlsVisible) return;
|
||||
|
||||
setState(() {
|
||||
_isScrubbing = true;
|
||||
_scrubbingStartPosition = widget.controller.value.position;
|
||||
_scrubbingStartDx = details.globalPosition.dx;
|
||||
_scrubbingSeekPosition = widget.controller.value.position;
|
||||
});
|
||||
_hideTimer?.cancel();
|
||||
}
|
||||
|
||||
void _onHorizontalDragUpdate(DragUpdateDetails details) {
|
||||
if (!_isScrubbing) return;
|
||||
|
||||
final double delta = details.globalPosition.dx - _scrubbingStartDx;
|
||||
final int seekMillis =
|
||||
_scrubbingStartPosition.inMilliseconds + (delta * 300).toInt();
|
||||
|
||||
setState(() {
|
||||
final Duration duration = widget.controller.value.duration;
|
||||
final Duration seekDuration = Duration(milliseconds: seekMillis);
|
||||
final Duration clampedSeekDuration = seekDuration < Duration.zero
|
||||
? Duration.zero
|
||||
: (seekDuration > duration ? duration : seekDuration);
|
||||
_scrubbingSeekPosition = clampedSeekDuration;
|
||||
});
|
||||
}
|
||||
|
||||
void _onHorizontalDragEnd(DragEndDetails details) {
|
||||
if (!_isScrubbing) return;
|
||||
|
||||
widget.controller.seekTo(_scrubbingSeekPosition);
|
||||
setState(() => _isScrubbing = false);
|
||||
_startHideTimer();
|
||||
}
|
||||
|
||||
void _onHorizontalDragCancel() {
|
||||
if (!_isScrubbing) return;
|
||||
setState(() => _isScrubbing = false);
|
||||
_startHideTimer();
|
||||
}
|
||||
|
||||
String _formatDuration(Duration? duration) {
|
||||
@ -180,25 +119,142 @@ class _VideoControlsOverlayState extends State<VideoControlsOverlay> {
|
||||
String twoDigits(int n) => n.toString().padLeft(2, '0');
|
||||
return "${twoDigits(duration.inMinutes % 60)}:${twoDigits(duration.inSeconds % 60)}";
|
||||
}
|
||||
}
|
||||
|
||||
class _ControlButton extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final VoidCallback onPressed;
|
||||
final double size;
|
||||
|
||||
const _ControlButton(this.icon, this.onPressed, {this.size = 24});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black.withValues(alpha: 0.4),
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
onTap: _toggleControlsVisibility,
|
||||
onHorizontalDragStart: _controlsVisible ? _onHorizontalDragStart : null,
|
||||
onHorizontalDragUpdate: _controlsVisible ? _onHorizontalDragUpdate : null,
|
||||
onHorizontalDragEnd: _controlsVisible ? _onHorizontalDragEnd : null,
|
||||
onHorizontalDragCancel: _controlsVisible ? _onHorizontalDragCancel : null,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
color: _controlsVisible && !_isScrubbing
|
||||
? Colors.black.withValues(alpha: 0.5)
|
||||
: Colors.transparent,
|
||||
),
|
||||
child: IconButton(
|
||||
icon: Icon(icon, size: size),
|
||||
onPressed: onPressed,
|
||||
),
|
||||
),
|
||||
AnimatedOpacity(
|
||||
opacity: _isScrubbing ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: _buildScrubbingIndicator(),
|
||||
),
|
||||
AnimatedOpacity(
|
||||
opacity: _controlsVisible && !_isScrubbing ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: _buildBottomBar(),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildScrubbingIndicator() {
|
||||
final Duration positionChange =
|
||||
_scrubbingSeekPosition - _scrubbingStartPosition;
|
||||
final String changeSign = positionChange.isNegative ? '-' : '+';
|
||||
final String changeText = _formatDuration(positionChange.abs());
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withValues(alpha: 0.7),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
_formatDuration(_scrubbingSeekPosition),
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 22,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'[$changeSign$changeText]',
|
||||
style: TextStyle(
|
||||
color: Colors.white.withValues(alpha: 0.8),
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomBar() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 5),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
widget.controller.value.isPlaying
|
||||
? Icons.pause
|
||||
: Icons.play_arrow,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
size: 24,
|
||||
),
|
||||
onPressed: _handlePlayPause,
|
||||
constraints: const BoxConstraints(),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
Text(
|
||||
_formatDuration(widget.controller.value.position),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: VideoProgressIndicator(
|
||||
widget.controller,
|
||||
allowScrubbing: true,
|
||||
colors: VideoProgressColors(
|
||||
playedColor: Theme.of(context).colorScheme.primary,
|
||||
backgroundColor: Colors.white.withValues(alpha: 0.3),
|
||||
bufferedColor: Colors.white.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatDuration(widget.controller.value.duration),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Obx(
|
||||
() => IconButton(
|
||||
icon: Icon(
|
||||
_settingsController.muted.value
|
||||
? Icons.volume_off
|
||||
: Icons.volume_up,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
size: 24,
|
||||
),
|
||||
onPressed: () {
|
||||
_settingsController.toggleMuted();
|
||||
_startHideTimer();
|
||||
},
|
||||
constraints: const BoxConstraints(),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import 'package:get/get.dart';
|
||||
|
||||
import 'package:f0ckapp/models/item.dart';
|
||||
import 'package:f0ckapp/widgets/video_controls_overlay.dart';
|
||||
import 'package:f0ckapp/controller/settingscontroller.dart';
|
||||
import 'package:f0ckapp/controller/mediacontroller.dart';
|
||||
|
||||
class VideoWidget extends StatefulWidget {
|
||||
@ -15,6 +16,7 @@ class VideoWidget extends StatefulWidget {
|
||||
final bool isActive;
|
||||
final bool fullScreen;
|
||||
final VoidCallback? onInitialized;
|
||||
final Duration? initialPosition;
|
||||
|
||||
const VideoWidget({
|
||||
super.key,
|
||||
@ -22,72 +24,69 @@ class VideoWidget extends StatefulWidget {
|
||||
required this.isActive,
|
||||
this.fullScreen = false,
|
||||
this.onInitialized,
|
||||
this.initialPosition,
|
||||
});
|
||||
|
||||
@override
|
||||
State<VideoWidget> createState() => _VideoWidgetState();
|
||||
State<VideoWidget> createState() => VideoWidgetState();
|
||||
}
|
||||
|
||||
class _VideoWidgetState extends State<VideoWidget> {
|
||||
final MediaController controller = Get.find<MediaController>();
|
||||
late CachedVideoPlayerPlusController _controller;
|
||||
class VideoWidgetState extends State<VideoWidget> {
|
||||
final MediaController mediaController = Get.find<MediaController>();
|
||||
final SettingsController settingsController = Get.find<SettingsController>();
|
||||
late CachedVideoPlayerPlusController videoController;
|
||||
late Worker _muteWorker;
|
||||
late Worker _timerResetWorker;
|
||||
late Worker _hideControlsWorker;
|
||||
bool _showControls = false;
|
||||
Timer? _hideControlsTimer;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initController();
|
||||
_muteWorker = ever(controller.muted, (bool muted) {
|
||||
if (_controller.value.isInitialized) {
|
||||
_controller.setVolume(muted ? 0.0 : 1.0);
|
||||
}
|
||||
});
|
||||
_timerResetWorker = ever(controller.videoControlsTimerNotifier, (_) {
|
||||
if (widget.isActive && mounted) {
|
||||
if (!_showControls) {
|
||||
setState(() => _showControls = true);
|
||||
}
|
||||
_startHideControlsTimer();
|
||||
}
|
||||
});
|
||||
_hideControlsWorker = ever(controller.hideControlsNotifier, (_) {
|
||||
if (mounted && _showControls) {
|
||||
setState(() => _showControls = false);
|
||||
_hideControlsTimer?.cancel();
|
||||
_muteWorker = ever(settingsController.muted, (bool muted) {
|
||||
if (videoController.value.isInitialized) {
|
||||
videoController.setVolume(muted ? 0.0 : 1.0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _initController() async {
|
||||
_controller = CachedVideoPlayerPlusController.networkUrl(
|
||||
videoController = CachedVideoPlayerPlusController.networkUrl(
|
||||
Uri.parse(widget.details.mediaUrl),
|
||||
videoPlayerOptions: VideoPlayerOptions(mixWithOthers: true),
|
||||
);
|
||||
await _controller.initialize();
|
||||
widget.onInitialized?.call();
|
||||
await videoController.initialize();
|
||||
if (!mounted) return;
|
||||
|
||||
setState(() {});
|
||||
_controller.addListener(() => setState(() {}));
|
||||
_controller.setLooping(true);
|
||||
_controller.setVolume(controller.muted.value ? 0.0 : 1.0);
|
||||
|
||||
if (widget.initialPosition != null) {
|
||||
await videoController.seekTo(widget.initialPosition!);
|
||||
}
|
||||
widget.onInitialized?.call();
|
||||
videoController.setLooping(true);
|
||||
videoController.setVolume(settingsController.muted.value ? 0.0 : 1.0);
|
||||
|
||||
if (widget.isActive) {
|
||||
_controller.play();
|
||||
videoController.play();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant VideoWidget oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
|
||||
if (widget.details.mediaUrl != oldWidget.details.mediaUrl) {
|
||||
videoController.dispose();
|
||||
_initController();
|
||||
return;
|
||||
}
|
||||
|
||||
if (widget.isActive != oldWidget.isActive) {
|
||||
if (videoController.value.isInitialized) {
|
||||
if (widget.isActive) {
|
||||
_controller.play();
|
||||
videoController.play();
|
||||
} else {
|
||||
_controller.pause();
|
||||
videoController.pause();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -95,42 +94,14 @@ class _VideoWidgetState extends State<VideoWidget> {
|
||||
@override
|
||||
void dispose() {
|
||||
_muteWorker.dispose();
|
||||
_timerResetWorker.dispose();
|
||||
_hideControlsWorker.dispose();
|
||||
_controller.dispose();
|
||||
_hideControlsTimer?.cancel();
|
||||
videoController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _startHideControlsTimer() {
|
||||
_hideControlsTimer?.cancel();
|
||||
_hideControlsTimer = Timer(const Duration(seconds: 3), () {
|
||||
if (mounted) {
|
||||
setState(() => _showControls = false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _onTap({bool ctrlButton = false}) {
|
||||
if (ctrlButton) {
|
||||
_startHideControlsTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
final bool newShowState = !_showControls;
|
||||
setState(() => _showControls = newShowState);
|
||||
|
||||
if (newShowState) {
|
||||
_startHideControlsTimer();
|
||||
} else {
|
||||
_hideControlsTimer?.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool muted = controller.muted.value;
|
||||
bool isAudio = widget.details.mime.startsWith('audio');
|
||||
final bool isInitialized = videoController.value.isInitialized;
|
||||
final bool isAudio = widget.details.mime.startsWith('audio');
|
||||
|
||||
Widget mediaContent;
|
||||
if (isAudio) {
|
||||
@ -144,35 +115,22 @@ class _VideoWidgetState extends State<VideoWidget> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
mediaContent = _controller.value.isInitialized
|
||||
? CachedVideoPlayerPlus(_controller)
|
||||
mediaContent = isInitialized
|
||||
? CachedVideoPlayerPlus(videoController)
|
||||
: const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
return AspectRatio(
|
||||
aspectRatio: _controller.value.isInitialized
|
||||
? _controller.value.aspectRatio
|
||||
aspectRatio: isInitialized
|
||||
? videoController.value.aspectRatio
|
||||
: (isAudio ? 16 / 9 : 9 / 16),
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
GestureDetector(onTap: _onTap, child: mediaContent),
|
||||
if (_controller.value.isInitialized && _showControls)
|
||||
mediaContent,
|
||||
if (isInitialized)
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
onTap: _onTap,
|
||||
child: Container(
|
||||
color: Colors.black.withValues(alpha: 0.5),
|
||||
child: VideoControlsOverlay(
|
||||
controller: _controller,
|
||||
onOverlayTap: () => _onTap(ctrlButton: true),
|
||||
muted: muted,
|
||||
onMuteToggle: () {
|
||||
controller.toggleMuted();
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
child: VideoControlsOverlay(controller: videoController),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
30
pubspec.lock
30
pubspec.lock
@ -249,7 +249,7 @@ packages:
|
||||
source: hosted
|
||||
version: "0.15.6"
|
||||
http:
|
||||
dependency: "direct main"
|
||||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
|
||||
@ -264,14 +264,22 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.1.2"
|
||||
intl:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.20.2"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: js
|
||||
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
|
||||
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.7"
|
||||
version: "0.7.2"
|
||||
json_rpc_2:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -661,6 +669,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.6"
|
||||
timeago:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: timeago
|
||||
sha256: b05159406a97e1cbb2b9ee4faa9fb096fe0e2dfcd8b08fcd2a00553450d3422e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.7.1"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -761,10 +777,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
|
||||
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "15.0.0"
|
||||
version: "15.0.2"
|
||||
web:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -801,10 +817,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba"
|
||||
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.13.0"
|
||||
version: "5.14.0"
|
||||
xdg_directories:
|
||||
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.4.2+63
|
||||
version: 1.4.9+70
|
||||
|
||||
environment:
|
||||
sdk: ^3.9.0-100.2.beta
|
||||
@ -30,7 +30,6 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
http: ^1.4.0
|
||||
get: ^4.7.2
|
||||
encrypt_shared_preferences: ^0.9.9
|
||||
cached_network_image: ^3.4.1
|
||||
@ -38,6 +37,7 @@ dependencies:
|
||||
share_plus: ^11.0.0
|
||||
flutter_cache_manager: ^3.4.1
|
||||
pullex: ^1.0.0
|
||||
timeago: ^3.7.1
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
Reference in New Issue
Block a user