Files
nsrb a7c6058540 Add cxyz Android project structure and initial configuration
- Introduced a new Flutter project for the cxyz Android manga/comic reader, including essential files such as pubspec.yaml, AndroidManifest.xml, and Gradle configuration.
- Added .gitignore files to exclude unnecessary files and directories for both the main project and Android-specific files.
- Implemented initial README.md with project description, features, setup instructions, and API details for ComicLand, MangaRead, and MangaTown.
- Configured analysis options and dependencies in pubspec.yaml to support Flutter development.
- Established a pnpm workspace and lockfile for dependency management.
- Included various Android resources such as icons, styles, and launch backgrounds for a complete application setup.
2026-08-29 17:50:31 +07:00

57 lines
1.9 KiB
Dart

import 'package:flutter/material.dart' hide Title;
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import '../providers/providers.dart';
import '../sources/source.dart';
import 'widgets/comic_cover.dart';
class LibraryPage extends ConsumerWidget {
const LibraryPage({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final titlesAsync = ref.watch(libraryTitlesProvider);
return Scaffold(
appBar: AppBar(title: const Text('Library')),
body: titlesAsync.when(
loading: () => const Center(child: CircularProgressIndicator()),
error: (e, _) => Center(child: Text('Error: $e')),
data: (titles) {
if (titles.isEmpty) {
return const Center(
child: Padding(
padding: EdgeInsets.all(24),
child: Text(
'Star a series on its title page to add it to your Library.',
textAlign: TextAlign.center,
),
),
);
}
return ListView.separated(
itemCount: titles.length,
separatorBuilder: (context, index) => const Divider(height: 1),
itemBuilder: (context, i) {
final t = titles[i];
final sourceId = SourceId.tryParse(t.source);
final label = sourceId?.label ?? t.source;
return ListTile(
leading: SizedBox(
width: 48,
height: 64,
child: ComicCover(url: t.coverUrl, sourceId: sourceId),
),
title: Text(t.title),
subtitle: Text(label),
trailing: const Icon(Icons.star, size: 18),
onTap: () => context.push('/title/${t.id}'),
);
},
);
},
),
);
}
}