nkbmusic/lib/shared/widgets/catalog_builder.dart
metatroncubeswdev 178d2d00ab Nanga Kathai: Flutter app, self-hosted backend and song tools
- Flutter app (Android/iOS): home, explore, albums, search, player with
  equalizer, mini player, sign up/sign in with email codes, profile,
  encrypted offline downloads, About page
- server/: one-command deploy of self-hosted Supabase behind HestiaCP/nginx
  (or Caddy), migrations, backups, email templates
- supabase/migrations: schema, row-level security, profiles
- tools/: song scanner and importer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 10:39:26 -04:00

35 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../../app/theme.dart';
import '../../data/catalog_repository.dart';
import 'section_header.dart';
/// Shows a loader / retry state until the catalog is available.
class CatalogBuilder extends ConsumerWidget {
const CatalogBuilder({super.key, required this.builder});
final Widget Function(Catalog catalog) builder;
@override
Widget build(BuildContext context, WidgetRef ref) {
return ref.watch(catalogProvider).when(
data: builder,
loading: () => const Center(child: CircularProgressIndicator(color: NkColors.sun)),
error: (e, _) => Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const EmptyState(
icon: Icons.cloud_off_outlined,
title: "Couldn't load songs",
message: 'Check your connection. Downloaded songs still play offline.',
),
FilledButton(onPressed: () => ref.invalidate(catalogProvider), child: const Text('Try again')),
],
),
),
);
}
}