v1.0.26+26
All checks were successful
Flutter Schmutter / build (push) Successful in 3m20s

This commit is contained in:
2025-06-05 19:53:25 +02:00
parent bf77ccf8e3
commit 0d9ed1e6c1
9 changed files with 465 additions and 425 deletions

View File

@ -0,0 +1,88 @@
import 'package:f0ckapp/services/Api.dart';
import 'package:flutter/material.dart';
import 'package:f0ckapp/models/MediaItem.dart';
class MediaProvider extends ChangeNotifier {
int _typeid = 0;
int _mode = 0;
bool _random = false;
String? _tag;
int _crossAxisCount = 0;
final List<MediaItem> _mediaItems = [];
bool _isLoading = false;
List<String> types = ["alles", "image", "video", "audio"];
List<String> modes = ["sfw", "nsfw", "untagged", "all"];
String get type => types[_typeid];
int get typeid => _typeid;
int get mode => _mode;
bool get random => _random;
String? get tag => _tag;
int get crossAxisCount => _crossAxisCount;
List<MediaItem> get mediaItems => _mediaItems;
bool get isLoading => _isLoading;
void setType(String type) {
_typeid = types.indexOf(type);
loadMedia(reload: true);
}
void setMode(int mode) {
_mode = mode;
loadMedia(reload: true);
}
void toggleRandom() {
_random = !_random;
loadMedia(reload: true);
}
void setTag(String? tag) {
_tag = tag;
loadMedia(reload: true);
}
void setCrossAxisCount(int crossAxisCount) {
_crossAxisCount = crossAxisCount;
notifyListeners();
}
void setMediaItems(List<MediaItem> mediaItems) {
_mediaItems.clear();
addMediaItems(mediaItems);
notifyListeners();
}
void addMediaItems(List<MediaItem> newItems) {
_mediaItems.addAll(newItems);
notifyListeners();
}
Future<void> loadMedia({bool reload = false}) async {
if (_isLoading) return;
_isLoading = true;
notifyListeners();
try {
final newMedia = await fetchMedia(
older: reload
? null
: _mediaItems.isNotEmpty
? _mediaItems.last.id
: null,
type: type,
mode: mode,
random: random,
tag: tag,
);
reload ? setMediaItems(newMedia) : addMediaItems(newMedia);
} catch (e) {
debugPrint('Fehler beim Laden der Medien: $e');
} finally {
_isLoading = false;
notifyListeners();
}
}
}

View File

@ -0,0 +1,132 @@
import 'package:flutter/material.dart';
final ThemeData f0ckTheme = ThemeData(
brightness: Brightness.dark,
primaryColor: Color(0xFF9FFF00),
scaffoldBackgroundColor: Color(0xFF000000),
colorScheme: ColorScheme.dark(
primary: Color(0xFF9FFF00),
secondary: Color(0xFF262626),
surface: Color(0xFF232323),
onPrimary: Color(0xFF000000),
onSecondary: Color(0xFFFFFFFF),
onSurface: Color(0xFFFFFFFF),
),
appBarTheme: AppBarTheme(
backgroundColor: Color(0xFF2B2B2B),
foregroundColor: Color(0xFF9FFF00),
elevation: 2,
),
textTheme: TextTheme(
bodyLarge: TextStyle(fontFamily: 'VCR', color: Color(0xFFFFFFFF)),
bodyMedium: TextStyle(fontFamily: 'monospace', color: Color(0xFFFFFFFF)),
),
buttonTheme: ButtonThemeData(
buttonColor: Color(0xFF9FFF00),
textTheme: ButtonTextTheme.primary,
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: WidgetStateProperty.all(Color(0xFF2B2B2B)),
trackColor: WidgetStateProperty.all(Color(0xFF424242)),
),
);
final ThemeData paperTheme = ThemeData(
brightness: Brightness.light,
primaryColor: Color(0xFF000000),
scaffoldBackgroundColor: Color(0xFFFFFFFF),
colorScheme: ColorScheme.light(
primary: Color(0xFF000000),
secondary: Color(0xFF262626),
surface: Color(0xFFFFFFFF),
onPrimary: Color(0xFFFFFFFF),
onSecondary: Color(0xFFFFFFFF),
onSurface: Color(0xFF000000),
),
appBarTheme: AppBarTheme(
backgroundColor: Color(0xFFFFFFFF),
foregroundColor: Color(0xFF000000),
elevation: 0,
),
textTheme: TextTheme(
bodyLarge: TextStyle(fontFamily: 'VCR', color: Color(0xFF000000)),
bodyMedium: TextStyle(fontFamily: 'monospace', color: Color(0xFF000000)),
),
buttonTheme: ButtonThemeData(
buttonColor: Color(0xFF000000),
textTheme: ButtonTextTheme.primary,
),
);
final ThemeData f0ck95Theme = ThemeData(
brightness: Brightness.light,
primaryColor: Color(0xFFC0C0C0),
scaffoldBackgroundColor: Color(0xFF008080),
colorScheme: ColorScheme.light(
primary: Color(0xFFC0C0C0),
secondary: Color(0xFF808080),
surface: Color(0xFFC0C0C0),
onPrimary: Color(0xFF000000),
onSecondary: Color(0xFFFFFFFF),
),
appBarTheme: AppBarTheme(
backgroundColor: Color(0xFFC0C0C0),
foregroundColor: Color(0xFF000000),
elevation: 2,
),
textTheme: TextTheme(
bodyLarge: TextStyle(fontFamily: 'VCR', color: Color(0xFF000000)),
bodyMedium: TextStyle(fontFamily: 'monospace', color: Color(0xFF000000)),
),
buttonTheme: ButtonThemeData(
buttonColor: Color(0xFF000000),
textTheme: ButtonTextTheme.primary,
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: WidgetStateProperty.all(Color(0xFF2B2B2B)),
trackColor: WidgetStateProperty.all(Color(0xFF424242)),
),
);
final ThemeData f0ck95dTheme = ThemeData(
brightness: Brightness.dark,
primaryColor: Color(0xFFFFFFFF),
scaffoldBackgroundColor: Color(0xFF0E0F0F),
colorScheme: ColorScheme.dark(
primary: Color(0xFFFFFFFF),
secondary: Color(0xFFC0C0C0),
surface: Color(0xFF333131),
onPrimary: Color(0xFF000000),
onSecondary: Color(0xFFFFFFFF),
),
appBarTheme: AppBarTheme(
backgroundColor: Color(0xFF0B0A0A),
foregroundColor: Color(0xFFFFFFFF),
elevation: 2,
),
textTheme: TextTheme(
bodyLarge: TextStyle(fontFamily: 'VCR', color: Color(0xFFFFFFFF)),
bodyMedium: TextStyle(fontFamily: 'monospace', color: Color(0xFFFFFFFF)),
),
buttonTheme: ButtonThemeData(
buttonColor: Color(0xFFFFFFFF),
textTheme: ButtonTextTheme.primary,
),
scrollbarTheme: ScrollbarThemeData(
thumbColor: WidgetStateProperty.all(Color(0xFF2B2B2B)),
trackColor: WidgetStateProperty.all(Color(0xFF424242)),
),
);
class ThemeProvider extends ChangeNotifier {
ThemeData _themeData = f0ck95dTheme;
ThemeData get themeData => _themeData;
/*void toggleTheme() {
_themeData = _themeData == lightTheme ? darkTheme : lightTheme;
notifyListeners();
}*/
}