v1.1.11+41
All checks were successful
Flutter Schmutter / build (push) Successful in 3m57s

- fixed: duplicates on the frontpage
- new: search by tag
This commit is contained in:
2025-06-10 08:39:55 +02:00
parent e945844151
commit c35308fbc1
11 changed files with 187 additions and 35 deletions

View File

@ -28,20 +28,20 @@ class F0ckApp extends ConsumerWidget {
routes: [
GoRoute(
path: '/',
builder: (context, state) {
builder: (BuildContext context, GoRouterState state) {
return const MediaGrid();
},
),
GoRoute(
path: '/:rest(.*)',
builder: (context, state) {
final isInternalLink = (state.extra is bool && state.extra == true);
final fullPath = state.matchedLocation;
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 match = regExp.firstMatch(fullPath);
final RegExpMatch? match = regExp.firstMatch(fullPath);
if (match == null) {
return const Scaffold(body: Center(child: Text('Ungültiger Link')));
@ -51,12 +51,12 @@ class F0ckApp extends ConsumerWidget {
final String? mime = match.namedGroup('mime');
final String? idStr = match.namedGroup('itemid');
final int? itemId = idStr != null ? int.tryParse(idStr) : null;
const preloadOffset = 50;
const int preloadOffset = 50;
return Consumer(
builder: (context, ref, child) {
builder: (BuildContext context, WidgetRef ref, Widget? child) {
WidgetsBinding.instance.addPostFrameCallback((_) async {
final mediaNotifier = ref.read(mediaProvider.notifier);
final MediaNotifier mediaNotifier = ref.read(mediaProvider.notifier);
if (!isInternalLink) {
mediaNotifier.setType(mime ?? "alles");
mediaNotifier.setTag(tag);
@ -79,7 +79,7 @@ class F0ckApp extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themeNotifierProvider);
final ThemeData theme = ref.watch(themeNotifierProvider);
return MaterialApp.router(
debugShowCheckedModeBanner: false,
routerConfig: _router,