Compare commits

...

15 Commits

Author SHA1 Message Date
493422e724 v1.1.15+45
All checks were successful
Flutter Schmutter / build (push) Successful in 3m35s
- buildtest lol
2025-06-11 11:22:00 +02:00
3b95d128e1 fk gitea 2025-06-11 11:01:40 +02:00
57636c5de6 v1.1.14+44
All checks were successful
Flutter Schmutter / build (push) Successful in 3m32s
2025-06-11 10:52:15 +02:00
f75299f0d4 xd
All checks were successful
Flutter Schmutter / build (push) Successful in 3m53s
2025-06-10 18:53:52 +02:00
03c6431eca v1.1.13+43
- fk android
2025-06-10 18:53:07 +02:00
5876c809a5 v1.1.12+42
All checks were successful
Flutter Schmutter / build (push) Successful in 3m45s
- search schmearch
2025-06-10 11:07:00 +02:00
c35308fbc1 v1.1.11+41
All checks were successful
Flutter Schmutter / build (push) Successful in 3m57s
- fixed: duplicates on the frontpage
- new: search by tag
2025-06-10 08:39:55 +02:00
e945844151 v1.1.10+40
All checks were successful
Flutter Schmutter / build (push) Successful in 3m56s
- download button lel
2025-06-09 19:08:23 +02:00
74eb6e3d26 readme & license 2025-06-09 15:42:13 +02:00
9755066d1e full retard renaming 2025-06-09 15:04:03 +02:00
671b3cfbe0 v1.1.9+39
All checks were successful
Flutter Schmutter / build (push) Successful in 3m35s
2025-06-09 14:02:59 +02:00
93fb3536ee v1.1.8+38
All checks were successful
Flutter Schmutter / build (push) Successful in 3m48s
- blah
2025-06-08 19:40:06 +02:00
346e447d5e v1.1.7+37
All checks were successful
Flutter Schmutter / build (push) Successful in 3m44s
- worst update eu west
2025-06-08 17:16:10 +02:00
f7777821fd iiiiiicon 2025-06-08 10:33:05 +02:00
ffbde73300 v1.1.6+36
All checks were successful
Flutter Schmutter / build (push) Successful in 3m34s
- new theme: p1nk
- optimizations
2025-06-07 23:07:31 +02:00
60 changed files with 743 additions and 256 deletions

View File

@ -51,3 +51,9 @@ jobs:
files: |-
build/app/outputs/flutter-apk/app-release.apk
token: '${{secrets.RELEASE_TOKEN}}'
- name: wait for gitea to catch up xD
run: sleep 5
- name: trigger fdroid puller
run: curl https://flumm.io/pullfdroid.php?token=${{secrets.PULLER_TOKEN}}

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 f0ck
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,16 +1,48 @@
# f0ckapp
# fApp
![f0ck.me Logo](https://git.lat/f0ck/fApp/raw/branch/master/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png)
## Overview
A new Flutter project.
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.
## Getting Started
## Installation
This project is a starting point for a Flutter application.
fApp is available in its own F-Droid repository.
A few resources to get you started if this is your first Flutter project:
### Installation Steps
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
1. Add the F-Droid repository to your F-Droid app:
- Go to the settings in the F-Droid app.
- Select "Repositories" and add the URL `https://fdroid.flumm.io/fdroid/repo/`.
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
2. Search for "f0ckapp" in the F-Droid app and install the app.
## Development
### Prerequisites
- Flutter SDK
- Dart SDK
- Android Studio or Visual Studio Code
### Setting Up the Project
1. Clone the repository:
```bash
git clone https://git.lat/f0ck/fApp.git
cd fApp
2. Install dependencies:
```flutter pub get```
3. Run the app:
```flutter run```
### Contributing
don't.
### License
This project is licensed under the MIT License. See the LICENSE file for more information.
### Contact
For questions or feedback, you can reach us at [contact@f0ck.me](mailto:contact@f0ck.me).

View File

@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:label="f0ckapp"
android:name="${applicationName}"
@ -14,8 +15,7 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:requestLegacyExternalStorage="true">
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
@ -28,12 +28,26 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="flutter_deeplinking_enabled" android:value="false"/>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https" android:host="f0ck.me"/>
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="f0ck" android:host="com.f0ck.f0ckapp"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and

View File

@ -1,5 +1,69 @@
package com.f0ck.f0ckapp
import android.content.ContentValues
import android.content.Context
import android.os.Environment
import android.provider.MediaStore
import androidx.annotation.NonNull
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import java.io.File
import java.io.FileInputStream
class MainActivity : FlutterActivity()
class MainActivity : FlutterActivity() {
private val CHANNEL = "MediaShit"
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine): Unit {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
call,
result ->
if (call.method == "saveFile") {
val filePath = call.argument<String>("filePath")
val fileName = call.argument<String>("fileName")
val subDir = call.argument<String?>("subDir")
if (filePath == null || fileName == null)
result.error("SAVE_FAILED", "file not found", null)
if (!saveFileUsingMediaStore(applicationContext, filePath!!, fileName!!, subDir))
result.error("COPY_FAILED", "Datei konnte nicht gespeichert werden", null)
result.success(true)
} else result.notImplemented()
}
}
private fun saveFileUsingMediaStore(
context: Context,
filePath: String,
fileName: String,
subDir: String?
): Boolean {
val srcFile = File(filePath)
if (!srcFile.exists()) return false
val values =
ContentValues().apply {
put(MediaStore.MediaColumns.DISPLAY_NAME, fileName)
put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DOWNLOADS + "/" + (subDir ?: "f0ck"))
put(MediaStore.MediaColumns.IS_PENDING, 1)
}
val resolver = context.contentResolver
val collection = MediaStore.Downloads.EXTERNAL_CONTENT_URI
val uri = resolver.insert(collection, values) ?: return false
resolver.openOutputStream(uri).use { out ->
FileInputStream(srcFile).use { input -> input.copyTo(out!!, 4096) }
}
values.clear()
values.put(MediaStore.MediaColumns.IS_PENDING, 0)
resolver.update(uri, values, null, null)
return true
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 KiB

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,33 +1,87 @@
import 'package:f0ckapp/providers/media_provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:f0ckapp/screens/MediaGrid.dart';
import 'package:f0ckapp/utils/AppVersion.dart';
import 'package:f0ckapp/providers/ThemeProvider.dart';
import 'package:go_router/go_router.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:f0ckapp/screens/mediagrid_screen.dart';
import 'package:f0ckapp/screens/detailview_screen.dart';
import 'package:f0ckapp/utils/appversion_util.dart';
import 'package:f0ckapp/providers/theme_provider.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
await AppVersion.init();
runApp(ProviderScope(child: const F0ckApp()));
runApp(ProviderScope(child: F0ckApp()));
}
class F0ckApp extends ConsumerWidget {
const F0ckApp({super.key});
F0ckApp({super.key});
final GoRouter _router = GoRouter(
initialLocation: '/',
routes: [
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
return const MediaGrid();
},
),
GoRoute(
path: '/:rest(.*)',
builder: (context, state) {
final bool isInternalLink = (state.extra is bool && state.extra == true);
final String fullPath = state.matchedLocation;
final regExp = RegExp(
r'^(?:/tag/(?<tag>.+?))?(?:/(?<mime>image|audio|video))?(?:/(?<itemid>\d+))?$',
);
final RegExpMatch? match = regExp.firstMatch(fullPath);
if (match == null) {
return const Scaffold(body: Center(child: Text('Ungültiger Link')));
}
final String? tag = match.namedGroup('tag');
final String? mime = match.namedGroup('mime');
final String? idStr = match.namedGroup('itemid');
final int? itemId = idStr != null ? int.tryParse(idStr) : null;
const int preloadOffset = 50;
return Consumer(
builder: (BuildContext context, WidgetRef ref, Widget? child) {
WidgetsBinding.instance.addPostFrameCallback((_) async {
final MediaNotifier mediaNotifier = ref.read(mediaProvider.notifier);
if (!isInternalLink) {
mediaNotifier.setType(mime ?? "alles");
mediaNotifier.setTag(tag);
}
if (itemId != null) {
await mediaNotifier.loadMedia(id: itemId + preloadOffset);
}
});
if (itemId != null) {
return DetailView(initialItemId: itemId);
} else {
return MediaGrid();
}
},
);
},
),
],
);
@override
Widget build(BuildContext context, WidgetRef ref) {
return Consumer(
builder: (context, ref, _) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ref.watch(themeNotifierProvider),
home: const MediaGrid(),
);
},
final ThemeData theme = ref.watch(themeNotifierProvider);
return MaterialApp.router(
debugShowCheckedModeBanner: false,
routerConfig: _router,
theme: theme,
);
}
}

View File

@ -0,0 +1,19 @@
class Suggestion {
final String tag;
final int tagged;
final double score;
Suggestion({
required this.tag,
required this.tagged,
required this.score,
});
factory Suggestion.fromJson(Map<String, dynamic> json) {
return Suggestion(
tag: json['tag'].toString(),
tagged: json['tagged'],
score: (json['score'] as num).toDouble(),
);
}
}

View File

@ -1,8 +1,8 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:f0ckapp/models/MediaItem.dart';
import 'package:f0ckapp/services/Api.dart';
import 'package:f0ckapp/models/mediaitem_model.dart';
import 'package:f0ckapp/services/api_service.dart';
const List<String> mediaTypes = ["alles", "image", "video", "audio"];
const List<String> mediaModes = ["sfw", "nsfw", "untagged", "all"];
@ -102,18 +102,25 @@ class MediaNotifier extends StateNotifier<MediaState> {
}
void addMediaItems(List<MediaItem> newItems) {
final updated = List<MediaItem>.from(state.mediaItems)..addAll(newItems);
state = state.replace(mediaItems: updated);
final Set<int> existingIds = state.mediaItems
.map((item) => item.id)
.toSet();
final List<MediaItem> filteredItems = newItems
.where((item) => !existingIds.contains(item.id))
.toList();
if (filteredItems.isNotEmpty) {
final List<MediaItem> updated = List<MediaItem>.from(state.mediaItems)
..addAll(filteredItems);
state = state.replace(mediaItems: updated);
}
}
Future<void> loadMedia() async {
Future<void> loadMedia({int? id}) async {
if (state.isLoading) return;
state = state.replace(isLoading: true);
try {
final older = state.mediaItems.isNotEmpty
? state.mediaItems.last.id
: null;
final older =
id ?? (state.mediaItems.isNotEmpty ? state.mediaItems.last.id : null);
final newMedia = await fetchMedia(
older: older,
type: mediaTypes[state.typeIndex],

View File

@ -3,6 +3,17 @@ import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final Map<String, ThemeData> themeMap = {
'f0ck': f0ckTheme,
'P1nk': p1nkTheme, // done
'Orange': orangeTheme,
'Amoled': amoledTheme,
'Paper': paperTheme,
//'Iced': icedTheme,
'f0ck95': f0ck95Theme,
'f0ck95d': f0ck95dTheme,
};
class ThemeNotifier extends StateNotifier<ThemeData> {
final FlutterSecureStorage secureStorage;
@ -11,23 +22,24 @@ class ThemeNotifier extends StateNotifier<ThemeData> {
}
Future<void> _loadTheme() async {
String? savedThemeName = await secureStorage.read(key: 'theme');
if (savedThemeName != null) {
final customTheme = themes.firstWhere(
(t) => t.name == savedThemeName,
orElse: () => CustomTheme(name: 'f0ck', theme: f0ckTheme),
);
state = customTheme.theme;
try {
String? savedThemeName = await secureStorage.read(key: 'theme');
if (savedThemeName != null && themeMap.containsKey(savedThemeName)) {
state = themeMap[savedThemeName]!;
}
} catch (error) {
debugPrint('Fehler beim Laden des Themes: $error');
state = f0ckTheme;
}
}
Future<void> updateTheme(String themeName) async {
await secureStorage.write(key: 'theme', value: themeName);
final newTheme = themes.firstWhere(
(t) => t.name == themeName,
orElse: () => CustomTheme(name: 'f0ck', theme: f0ckTheme),
);
state = newTheme.theme;
try {
await secureStorage.write(key: 'theme', value: themeName);
state = themeMap[themeName] ?? f0ckTheme;
} catch (error) {
debugPrint('Fehler beim Aktualisieren des Themes: $error');
}
}
}
@ -35,28 +47,12 @@ final themeNotifierProvider = StateNotifierProvider<ThemeNotifier, ThemeData>((
ref,
) {
return ThemeNotifier(
secureStorage: FlutterSecureStorage(
secureStorage: const FlutterSecureStorage(
aOptions: AndroidOptions(encryptedSharedPreferences: true),
),
);
});
class CustomTheme {
final String name;
final ThemeData theme;
CustomTheme({required this.name, required this.theme});
}
final List<CustomTheme> themes = [
CustomTheme(name: 'f0ck', theme: f0ckTheme),
CustomTheme(name: 'Paper', theme: paperTheme),
CustomTheme(name: 'Orange', theme: orangeTheme),
CustomTheme(name: 'Amoled', theme: amoledTheme),
CustomTheme(name: 'f0ck95', theme: f0ck95Theme),
CustomTheme(name: 'f0ck95d', theme: f0ck95dTheme),
];
final ThemeData f0ckTheme = ThemeData(
brightness: Brightness.dark,
primaryColor: const Color(0xFF9FFF00),
@ -78,13 +74,53 @@ final ThemeData f0ckTheme = ThemeData(
bodyLarge: TextStyle(color: Colors.white),
bodyMedium: TextStyle(color: Colors.white),
),
buttonTheme: ButtonThemeData(
buttonColor: const Color(0xFF9FFF00),
textTheme: ButtonTextTheme.primary,
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF000000),
backgroundColor: const Color(0xFF9FFF00),
),
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: WidgetStatePropertyAll<Color>(Color(0xFF2B2B2B)),
trackColor: WidgetStatePropertyAll<Color>(Color(0xFF424242)),
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF2B2B2B)),
trackColor: WidgetStateProperty.all<Color>(const Color(0xFF424242)),
),
);
final ThemeData p1nkTheme = ThemeData(
brightness: Brightness.dark,
primaryColor: const Color(0xFF171717),
scaffoldBackgroundColor: const Color(0xFF171717),
appBarTheme: const AppBarTheme(
color: Color(0xFF2B2B2B),
foregroundColor: Color(0xFFFF00D0),
elevation: 2,
),
textTheme: const TextTheme(
bodyLarge: TextStyle(color: Color(0xFFFFFFFF)),
bodyMedium: TextStyle(color: Color(0xFFFFFFFF)),
titleLarge: TextStyle(color: Color(0xFFFFFFFF)),
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFF000000),
backgroundColor: const Color(0xFFFF00D0),
),
),
progressIndicatorTheme: const ProgressIndicatorThemeData(
color: Color(0xFFFF00D0),
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: WidgetStateProperty.all(const Color(0xFF2B2B2B)),
trackColor: WidgetStateProperty.all(const Color(0xFF424242)),
),
colorScheme: const ColorScheme.dark(
primary: Color(0xFF171717),
secondary: Color(0xFFFF00D0),
surface: Color(0xFF171717),
onPrimary: Color(0xFFFFFFFF),
onSecondary: Color(0xFF000000),
onSurface: Color(0xFFFFFFFF),
error: Color(0xFFA72828),
),
);
@ -109,9 +145,11 @@ final ThemeData paperTheme = ThemeData(
bodyLarge: TextStyle(color: Color(0xFF000000)),
bodyMedium: TextStyle(color: Color(0xFF000000)),
),
buttonTheme: ButtonThemeData(
buttonColor: const Color(0xFF000000),
textTheme: ButtonTextTheme.primary,
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: const Color(0xFFFFFFFF),
backgroundColor: const Color(0xFF000000),
),
),
);
@ -136,13 +174,15 @@ final ThemeData orangeTheme = ThemeData(
bodyLarge: TextStyle(color: Colors.white),
bodyMedium: TextStyle(color: Colors.white),
),
buttonTheme: ButtonThemeData(
buttonColor: const Color(0xFFFF6F00),
textTheme: ButtonTextTheme.primary,
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: const Color(0xFFFF6F00),
),
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: WidgetStatePropertyAll<Color>(Color(0xFF2B2B2B)),
trackColor: WidgetStatePropertyAll<Color>(Color(0xFF424242)),
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF2B2B2B)),
trackColor: WidgetStateProperty.all<Color>(const Color(0xFF424242)),
),
);
@ -169,9 +209,11 @@ final ThemeData amoledTheme = ThemeData(
bodyLarge: TextStyle(color: Colors.white),
bodyMedium: TextStyle(color: Colors.white),
),
buttonTheme: ButtonThemeData(
buttonColor: const Color(0xFFFFFFFF),
textTheme: ButtonTextTheme.primary,
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.black,
backgroundColor: const Color(0xFFFFFFFF),
),
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF1D1C1C)),
@ -199,13 +241,15 @@ final ThemeData f0ck95Theme = ThemeData(
bodyLarge: TextStyle(color: Colors.black),
bodyMedium: TextStyle(color: Colors.black),
),
buttonTheme: ButtonThemeData(
buttonColor: Colors.black,
textTheme: ButtonTextTheme.primary,
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: Colors.black,
),
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: WidgetStatePropertyAll<Color>(Color(0xFF2B2B2B)),
trackColor: WidgetStatePropertyAll<Color>(Color(0xFF424242)),
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF2B2B2B)),
trackColor: WidgetStateProperty.all<Color>(const Color(0xFF424242)),
),
);
@ -229,12 +273,14 @@ final ThemeData f0ck95dTheme = ThemeData(
bodyLarge: TextStyle(color: Colors.white),
bodyMedium: TextStyle(color: Colors.white),
),
buttonTheme: ButtonThemeData(
buttonColor: Colors.white,
textTheme: ButtonTextTheme.primary,
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: Colors.black,
backgroundColor: Colors.white,
),
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: WidgetStatePropertyAll<Color>(Color(0xFF2B2B2B)),
trackColor: WidgetStatePropertyAll<Color>(Color(0xFF424242)),
thumbColor: WidgetStateProperty.all<Color>(const Color(0xFF2B2B2B)),
trackColor: WidgetStateProperty.all<Color>(const Color(0xFF424242)),
),
);

View File

@ -2,17 +2,19 @@ import 'dart:io';
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:go_router/go_router.dart';
import 'package:share_plus/share_plus.dart';
import 'package:f0ckapp/models/MediaItem.dart';
import 'package:f0ckapp/widgets/VideoWidget.dart';
import 'package:f0ckapp/utils/SmartRefreshIndicator.dart';
import 'package:f0ckapp/utils/PageTransformer.dart';
import 'package:f0ckapp/providers/MediaProvider.dart';
import 'package:f0ckapp/models/mediaitem_model.dart';
import 'package:f0ckapp/widgets/video_widget.dart';
import 'package:f0ckapp/utils/smartrefreshindicator_util.dart';
import 'package:f0ckapp/utils/pagetransformer_util.dart';
import 'package:f0ckapp/providers/media_provider.dart';
class DetailView extends ConsumerStatefulWidget {
final int initialItemId;
@ -24,40 +26,24 @@ class DetailView extends ConsumerStatefulWidget {
}
class _DetailViewState extends ConsumerState<DetailView> {
late PageController _pageController;
PageController? _pageController;
bool isLoading = false;
int _currentIndex = 0;
@override
void initState() {
super.initState();
final mediaState = ref.read(mediaProvider);
final initialIndex = mediaState.mediaItems.indexWhere(
(item) => item.id == widget.initialItemId,
);
_pageController = PageController(initialPage: initialIndex);
_currentIndex = initialIndex;
_pageController.addListener(() {
setState(() => _currentIndex = _pageController.page?.round() ?? 0);
});
_preloadAdjacentMedia(initialIndex);
}
void _preloadAdjacentMedia(int index) async {
final mediaState = ref.read(mediaProvider);
if (index + 1 < mediaState.mediaItems.length) {
final nextUrl = mediaState.mediaItems[index + 1].mediaUrl;
if (await DefaultCacheManager().getFileFromCache(nextUrl) == null) {
await DefaultCacheManager().downloadFile(nextUrl);
}
}
if (index - 1 >= 0) {
final prevUrl = mediaState.mediaItems[index - 1].mediaUrl;
if (await DefaultCacheManager().getFileFromCache(prevUrl) == null) {
await DefaultCacheManager().downloadFile(prevUrl);
for (int offset in [-1, 1]) {
final adjacentIndex = index + offset;
if (adjacentIndex >= 0 && adjacentIndex < mediaState.mediaItems.length) {
final url = mediaState.mediaItems[adjacentIndex].mediaUrl;
if (await DefaultCacheManager().getFileFromCache(url) == null) {
await DefaultCacheManager().downloadFile(url);
}
}
}
}
@ -69,48 +55,91 @@ class _DetailViewState extends ConsumerState<DetailView> {
try {
await ref.read(mediaProvider.notifier).loadMedia();
} catch (e) {
_showError("Fehler beim Laden der Medien: $e");
_showMsg("Fehler beim Laden der Medien: $e");
} finally {
setState(() => isLoading = false);
}
}
void _showError(String message) {
void _showMsg(String message) {
if (!mounted) return;
ScaffoldMessenger.of(context)
..removeCurrentSnackBar()
..showSnackBar(SnackBar(content: Text(message)));
}
Future<void> _downloadMedia() async {
final MediaState mediaState = ref.read(mediaProvider);
final MediaItem currentItem = mediaState.mediaItems[_currentIndex];
final File file = await DefaultCacheManager().getSingleFile(currentItem.mediaUrl);
final MethodChannel methodChannel = const MethodChannel('MediaShit');
bool? success = await methodChannel.invokeMethod<bool>('saveFile', {
'filePath': file.path,
'fileName': currentItem.dest,
});
success == true
? _showMsg('${currentItem.dest} wurde in Downloads/fApp neigespeichert.')
: _showMsg('${currentItem.dest} konnte nicht heruntergeladen werden.');
}
@override
void dispose() {
_pageController.dispose();
_pageController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final mediaState = ref.watch(mediaProvider);
final mediaNotifier = ref.read(mediaProvider.notifier);
final MediaState mediaState = ref.watch(mediaProvider);
final int itemIndex = mediaState.mediaItems.indexWhere(
(item) => item.id == widget.initialItemId,
);
if (mediaState.mediaItems.isEmpty) {
if (itemIndex == -1) {
Future.microtask(() {
ref
.read(mediaProvider.notifier)
.loadMedia(id: widget.initialItemId + 50);
});
return Scaffold(
appBar: AppBar(),
body: const Center(child: CircularProgressIndicator()),
);
}
if (_pageController == null) {
_pageController = PageController(initialPage: itemIndex);
_currentIndex = itemIndex;
_pageController!.addListener(() {
setState(() => _currentIndex = _pageController!.page?.round() ?? 0);
});
_preloadAdjacentMedia(itemIndex);
}
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('f0ck #${mediaState.mediaItems[_currentIndex].id}'),
automaticallyImplyLeading: false,
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
context.canPop() ? context.pop() : context.go('/', extra: true);
},
),
actions: [
IconButton(
icon: Icon(Icons.download),
icon: const Icon(Icons.fullscreen),
onPressed: () {
// wip
_showMsg('fullscreen ist wip');
},
),
IconButton(
icon: const Icon(Icons.download),
onPressed: _downloadMedia,
),
PopupMenuButton<String>(
onSelected: (value) async {
final item = mediaState.mediaItems[_currentIndex];
@ -167,7 +196,7 @@ class _DetailViewState extends ConsumerState<DetailView> {
body: Stack(
children: [
PageTransformer(
controller: _pageController,
controller: _pageController!,
pages: mediaState.mediaItems.map((item) {
int itemIndex = mediaState.mediaItems.indexOf(item);
return SafeArea(
@ -186,8 +215,8 @@ class _DetailViewState extends ConsumerState<DetailView> {
child: InputChip(
label: Text(mediaState.tag!),
onDeleted: () {
mediaNotifier.setTag(null);
Navigator.pop(context);
ref.read(mediaProvider.notifier).setTag(null);
context.go('/', extra: true);
},
),
),
@ -197,7 +226,7 @@ class _DetailViewState extends ConsumerState<DetailView> {
}
Widget _buildMediaItem(MediaItem item, bool isActive) {
final mediaNotifier = ref.read(mediaProvider.notifier);
final MediaNotifier mediaNotifier = ref.read(mediaProvider.notifier);
return SingleChildScrollView(
child: Column(
@ -221,7 +250,7 @@ class _DetailViewState extends ConsumerState<DetailView> {
if (tag.tag == 'sfw' || tag.tag == 'nsfw') return;
setState(() {
mediaNotifier.setTag(tag.tag);
Navigator.pop(context, true);
context.go('/', extra: true);
});
},
label: Text(tag.tag),

View File

@ -2,14 +2,13 @@ import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:f0ckapp/screens/DetailView.dart';
import 'package:f0ckapp/providers/MediaProvider.dart';
import 'package:f0ckapp/utils/AppVersion.dart';
import 'package:f0ckapp/providers/ThemeProvider.dart';
const List<String> mediaTypes = ["alles", "image", "video", "audio"];
const List<String> mediaModes = ["sfw", "nsfw", "untagged", "all"];
import 'package:f0ckapp/models/mediaitem_model.dart';
import 'package:f0ckapp/providers/media_provider.dart';
import 'package:f0ckapp/utils/appversion_util.dart';
import 'package:f0ckapp/providers/theme_provider.dart';
import 'package:f0ckapp/utils/customsearchdelegate_util.dart';
class MediaGrid extends ConsumerStatefulWidget {
const MediaGrid({super.key});
@ -55,8 +54,8 @@ class _MediaGridState extends ConsumerState<MediaGrid> {
@override
Widget build(BuildContext context) {
final mediaState = ref.watch(mediaProvider);
final mediaNotifier = ref.read(mediaProvider.notifier);
final MediaState mediaState = ref.watch(mediaProvider);
final MediaNotifier mediaNotifier = ref.read(mediaProvider.notifier);
return Scaffold(
key: _scaffoldKey,
@ -78,6 +77,15 @@ class _MediaGridState extends ConsumerState<MediaGrid> {
},
),
actions: [
IconButton(
icon: const Icon(Icons.search),
onPressed: () async {
await showSearch(
context: context,
delegate: CustomSearchDelegate(),
);
},
),
IconButton(
icon: Icon(
mediaState.random ? Icons.shuffle_on_outlined : Icons.shuffle,
@ -151,7 +159,7 @@ class _MediaGridState extends ConsumerState<MediaGrid> {
),
child: null,
),
ExpansionTile(
/*ExpansionTile(
title: const Text('Login'),
children: [
Padding(
@ -181,7 +189,7 @@ class _MediaGridState extends ConsumerState<MediaGrid> {
const SnackBar(
content: Text("noch nicht implementiert lol"),
),
/*final success = await login(
final success = await login(
_usernameController.text,
_passwordController.text,
);
@ -192,7 +200,7 @@ class _MediaGridState extends ConsumerState<MediaGrid> {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("Login fehlgeschlagen!")),
);
}*/
}
);
},
child: const Text('Login'),
@ -201,24 +209,26 @@ class _MediaGridState extends ConsumerState<MediaGrid> {
),
),
],
),
),*/
ExpansionTile(
title: const Text('Theme'),
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
children: themes.map((themeData) {
final currentTheme = ref.watch(themeNotifierProvider);
final isSelected = currentTheme == themeData.theme;
children: themeMap.entries.map((entry) {
final String themeName = entry.key;
final ThemeData themeData = entry.value;
final ThemeData currentTheme = ref.watch(themeNotifierProvider);
final bool isSelected = currentTheme == themeData;
return ListTile(
title: Text(themeData.name),
title: Text(themeName),
selected: isSelected,
selectedTileColor: Colors.blue.withValues(alpha: 0.2),
onTap: () async {
await ref
.read(themeNotifierProvider.notifier)
.updateTheme(themeData.name);
.updateTheme(themeName);
},
);
}).toList(),
@ -226,7 +236,6 @@ class _MediaGridState extends ConsumerState<MediaGrid> {
),
],
),
ListTile(
title: Text('v${AppVersion.version}'),
onTap: () {
@ -271,23 +280,15 @@ class _MediaGridState extends ConsumerState<MediaGrid> {
),
itemCount:
mediaState.mediaItems.length + (mediaState.isLoading ? 1 : 0),
itemBuilder: (context, index) {
itemBuilder: (BuildContext context, int index) {
if (index >= mediaState.mediaItems.length) {
return const Center(child: CircularProgressIndicator());
}
final item = mediaState.mediaItems[index];
final MediaItem item = mediaState.mediaItems[index];
return InkWell(
onTap: () async {
bool? ret = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DetailView(initialItemId: item.id),
),
);
if (ret != null && ret) {
_scrollController.jumpTo(0);
}
context.push('/${item.id}', extra: true);
},
child: Stack(
fit: StackFit.expand,

View File

@ -1,69 +0,0 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:f0ckapp/models/MediaItem.dart';
final storage = FlutterSecureStorage();
Future<List<MediaItem>> fetchMedia({
int? older,
String? type,
int? mode,
bool? random,
String? tag,
}) async {
final Uri url = Uri.parse('https://api.f0ck.me/items/get').replace(
queryParameters: {
'type': type ?? 'image',
'mode': (mode ?? 0).toString(),
'random': (random! ? 1 : 0).toString(),
if (tag != null) 'tag': tag,
if (older != null) 'older': older.toString(),
},
);
final response = await http.get(url);
if (response.statusCode == 200) {
final List<dynamic> jsonList = jsonDecode(response.body);
return jsonList.map((item) => MediaItem.fromJson(item)).toList();
} else {
throw Exception('Fehler beim Abrufen der Medien: ${response.statusCode}');
}
}
Future<MediaItem> fetchMediaDetail(int itemId) async {
final Uri url = Uri.parse('https://api.f0ck.me/item/${itemId.toString()}');
final response = await http.get(url);
if (response.statusCode == 200) {
final Map<String, dynamic> jsonResponse = jsonDecode(response.body);
return MediaItem.fromJson(jsonResponse);
} else {
throw Exception(
'Fehler beim Abrufen der Media-Details: ${response.statusCode}',
);
}
}
Future<bool> login(String username, String password) async {
final Uri url = Uri.parse('https://api.f0ck.me/login');
final response = await http.post(
url,
body: {'username': username, 'password': password},
);
if (response.statusCode == 200) {
final data = jsonDecode(response.body);
final token = data['token'];
await storage.write(key: "token", value: token);
return true;
} else {
return false;
}
}

View File

@ -0,0 +1,109 @@
import 'dart:async';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:f0ckapp/models/mediaitem_model.dart';
import 'package:f0ckapp/models/suggestion_model.dart';
final FlutterSecureStorage storage = const FlutterSecureStorage(
aOptions: AndroidOptions(encryptedSharedPreferences: true),
);
Future<List<MediaItem>> fetchMedia({
int? older,
String? type,
int? mode,
bool? random,
String? tag,
}) async {
final Uri url = Uri.parse('https://api.f0ck.me/items/get').replace(
queryParameters: {
'type': type ?? 'image',
'mode': (mode ?? 0).toString(),
'random': (random! ? 1 : 0).toString(),
if (tag != null) 'tag': tag,
if (older != null) 'older': older.toString(),
},
);
final http.Response response = await http.get(url);
if (response.statusCode == 200) {
final List<dynamic> jsonList = jsonDecode(response.body);
return jsonList.map((item) => MediaItem.fromJson(item)).toList();
} else {
throw Exception('Fehler beim Abrufen der Medien: ${response.statusCode}');
}
}
Future<MediaItem> fetchMediaDetail(int itemId) async {
final Uri url = Uri.parse('https://api.f0ck.me/item/${itemId.toString()}');
final http.Response response = await http.get(url);
if (response.statusCode == 200) {
final Map<String, dynamic> jsonResponse = jsonDecode(response.body);
return MediaItem.fromJson(jsonResponse);
} else {
throw Exception(
'Fehler beim Abrufen der Media-Details: ${response.statusCode}',
);
}
}
Future<List<Suggestion>> fetchSuggestions(String query) async {
final Uri uri = Uri.parse('https://api.f0ck.me/search/?q=$query');
try {
final http.Response response = await http
.get(uri)
.timeout(const Duration(seconds: 5));
if (response.statusCode == 200) {
final dynamic decoded = jsonDecode(response.body);
if (decoded is List) {
return decoded
.map((item) => Suggestion.fromJson(item as Map<String, dynamic>))
.toList()
..sort((a, b) => b.score.compareTo(a.score));
} else {
throw Exception('Unerwartetes Format: Erwartet wurde eine Liste.');
}
} else if (response.statusCode == 400) {
final dynamic error = jsonDecode(response.body);
final String message = error is Map<String, dynamic>
? error['detail']?.toString() ?? 'Unbekannter Fehler.'
: 'Unbekannter Fehler.';
throw Exception('Client-Fehler 400: $message');
} else {
throw Exception(
'Fehler beim Abrufen der Vorschläge: ${response.statusCode}',
);
}
} on TimeoutException {
throw Exception('Anfrage an die API hat zu lange gedauert.');
} catch (e) {
throw Exception('Fehler beim Verarbeiten der Anfrage: $e');
}
}
Future<bool> login(String username, String password) async {
final Uri url = Uri.parse('https://api.f0ck.me/login');
final http.Response response = await http.post(
url,
body: {'username': username, 'password': password},
);
if (response.statusCode == 200) {
final dynamic data = jsonDecode(response.body);
final dynamic token = data['token'];
await storage.write(key: "token", value: token);
return true;
} else {
return false;
}
}

View File

@ -0,0 +1,145 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:f0ckapp/services/api_service.dart';
import 'package:f0ckapp/models/suggestion_model.dart';
import 'package:f0ckapp/providers/media_provider.dart';
class CustomSearchDelegate extends SearchDelegate<String> {
Timer? _debounceTimer;
List<Suggestion>? _suggestions;
bool _isLoading = false;
String? _error;
String _lastFetchedQuery = "";
@override
List<Widget> buildActions(BuildContext context) {
return [
IconButton(
icon: const Icon(Icons.clear),
onPressed: () {
query = '';
_clearResults();
showSuggestions(context);
},
),
];
}
@override
Widget buildLeading(BuildContext context) {
return IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
_debounceTimer?.cancel();
close(context, 'null');
},
);
}
@override
Widget buildResults(BuildContext context) {
return Center(child: Text('Suchergebnisse für: "$query"'));
}
@override
Widget buildSuggestions(BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, void Function(void Function()) setState) {
if (query.isEmpty) {
_debounceTimer?.cancel();
return Container(padding: const EdgeInsets.all(16.0), child: const Text(''));
}
if (query != _lastFetchedQuery) {
_debounceTimer?.cancel();
_isLoading = true;
_error = null;
_suggestions = null;
_debounceTimer = Timer(Duration(milliseconds: 500), () async {
try {
final List<Suggestion> results = await fetchSuggestions(query);
_lastFetchedQuery = query;
setState(() {
_suggestions = results;
_isLoading = false;
});
} catch (e) {
_lastFetchedQuery = query;
setState(() {
_error = e.toString();
_suggestions = [];
_isLoading = false;
});
}
});
return Center(child: _buildLoadingIndicator());
}
if (_isLoading) {
return Center(child: _buildLoadingIndicator());
}
if (_error != null) {
return Center(child: Text("Fehler: $_error"));
}
if (_suggestions == null || _suggestions!.isEmpty) {
return Center(child: const Text("Keine Ergebnisse gefunden."));
}
return Consumer(
builder: (BuildContext context, WidgetRef ref, Widget? child) {
return ListView.builder(
itemCount: _suggestions!.length,
itemBuilder: (BuildContext context, int index) {
final Suggestion suggestion = _suggestions![index];
return ListTile(
title: Text(suggestion.tag),
subtitle: Text(
'Getaggt: ${suggestion.tagged}x • Score: ${suggestion.score.toStringAsFixed(2)}',
style: TextStyle(fontSize: 12),
),
onTap: () {
ref.read(mediaProvider.notifier).setTag(suggestion.tag);
close(context, suggestion.tag);
},
);
},
);
},
);
},
);
}
Widget _buildLoadingIndicator() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const CircularProgressIndicator(strokeWidth: 3.0),
const SizedBox(height: 12),
const Text(
'Vorschläge werden geladen...',
style: TextStyle(fontStyle: FontStyle.italic),
),
],
);
}
void _clearResults() {
_debounceTimer?.cancel();
_suggestions = null;
_isLoading = false;
_error = null;
_lastFetchedQuery = "";
}
@override
void close(BuildContext context, String result) {
_debounceTimer?.cancel();
super.close(context, result);
}
}

View File

@ -6,9 +6,9 @@ import 'package:cached_video_player_plus/cached_video_player_plus.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:f0ckapp/models/MediaItem.dart';
import 'package:f0ckapp/widgets/VideoOverlay.dart';
import 'package:f0ckapp/providers/MediaProvider.dart';
import 'package:f0ckapp/models/mediaitem_model.dart';
import 'package:f0ckapp/widgets/videooverlay_widget.dart';
import 'package:f0ckapp/providers/media_provider.dart';
class VideoWidget extends ConsumerStatefulWidget {
final MediaItem details;
@ -45,7 +45,7 @@ class _VideoWidgetState extends ConsumerState<VideoWidget> {
}
_controller.setLooping(true);
final muted = ref.read(mediaProvider).muted;
final bool muted = ref.read(mediaProvider).muted;
_controller.setVolume(muted ? 0.0 : 1.0);
}
@ -82,7 +82,7 @@ class _VideoWidgetState extends ConsumerState<VideoWidget> {
@override
Widget build(BuildContext context) {
final muted = ref.watch(mediaProvider).muted;
final bool muted = ref.watch(mediaProvider).muted;
if (_controller.value.isInitialized &&
_controller.value.volume != (muted ? 0.0 : 1.0)) {
_controller.setVolume(muted ? 0.0 : 1.0);

View File

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:cached_video_player_plus/cached_video_player_plus.dart';
import 'package:f0ckapp/providers/MediaProvider.dart';
import 'package:f0ckapp/providers/media_provider.dart';
class VideoControlsOverlay extends ConsumerWidget {
final CachedVideoPlayerPlusController controller;
@ -17,15 +17,15 @@ class VideoControlsOverlay extends ConsumerWidget {
@override
Widget build(BuildContext context, ref) {
final mediaState = ref.watch(mediaProvider);
final mediaNotifier = ref.read(mediaProvider.notifier);
final MediaState mediaState = ref.watch(mediaProvider);
final MediaNotifier mediaNotifier = ref.read(mediaProvider.notifier);
return Stack(
alignment: Alignment.center,
children: [
Positioned(
right: 12,
top: 12,
bottom: 12,
child: _ControlButton(
mediaState.muted ? Icons.volume_off : Icons.volume_up,
() {
@ -35,13 +35,6 @@ class VideoControlsOverlay extends ConsumerWidget {
size: 16,
),
),
Positioned(
right: 12,
bottom: 12,
child: _ControlButton(Icons.fullscreen, () {
button();
}, size: 16),
),
Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -89,7 +82,6 @@ class VideoControlsOverlay extends ConsumerWidget {
bottom: 12,
child: Text(
'${_formatDuration(controller.value.position)} / ${_formatDuration(controller.value.duration)}',
style: TextStyle(color: Colors.white),
),
),
Listener(
@ -153,7 +145,7 @@ class _ControlButton extends StatelessWidget {
color: Colors.black.withValues(alpha: 0.4),
),
child: IconButton(
icon: Icon(icon, color: Colors.white, size: size),
icon: Icon(icon, size: size),
onPressed: onPressed,
),
);

View File

@ -240,6 +240,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
go_router:
dependency: "direct main"
description:
name: go_router
sha256: b453934c36e289cef06525734d1e676c1f91da9e22e2017d9dcab6ce0f999175
url: "https://pub.dev"
source: hosted
version: "15.1.3"
html:
dependency: transitive
description:
@ -304,6 +312,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.0.0"
logging:
dependency: transitive
description:
name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.dev"
source: hosted
version: "1.3.0"
matcher:
dependency: transitive
description:

View File

@ -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.1.5+35
version: 1.1.15+45
environment:
sdk: ^3.9.0-100.2.beta
@ -41,6 +41,7 @@ dependencies:
share_plus: ^11.0.0
flutter_secure_storage: ^9.2.4
flutter_riverpod: ^2.6.1
go_router: ^15.1.3
dev_dependencies:
flutter_test:

View File

@ -13,7 +13,7 @@ import 'package:f0ckapp/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const F0ckApp());
await tester.pumpWidget(F0ckApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);