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.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
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 HistoryPage extends ConsumerWidget {
|
||||
const HistoryPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final titlesAsync = ref.watch(historyTitlesProvider);
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('History')),
|
||||
body: titlesAsync.when(
|
||||
loading: () => const Center(child: CircularProgressIndicator()),
|
||||
error: (e, _) => Center(child: Text('Error: $e')),
|
||||
data: (titles) {
|
||||
if (titles.isEmpty) {
|
||||
return const Center(
|
||||
child: Text('Chapters you read will show up here.'),
|
||||
);
|
||||
}
|
||||
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;
|
||||
final when = t.lastReadAt;
|
||||
final subtitle = when == null
|
||||
? label
|
||||
: '$label · ${_formatWhen(when)}';
|
||||
return ListTile(
|
||||
leading: SizedBox(
|
||||
width: 48,
|
||||
height: 64,
|
||||
child: ComicCover(url: t.coverUrl, sourceId: sourceId),
|
||||
),
|
||||
title: Text(t.title),
|
||||
subtitle: Text(subtitle),
|
||||
onTap: () => context.push('/title/${t.id}'),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String _formatWhen(DateTime dt) {
|
||||
final local = dt.toLocal();
|
||||
final y = local.year.toString().padLeft(4, '0');
|
||||
final m = local.month.toString().padLeft(2, '0');
|
||||
final d = local.day.toString().padLeft(2, '0');
|
||||
final hh = local.hour.toString().padLeft(2, '0');
|
||||
final mm = local.minute.toString().padLeft(2, '0');
|
||||
return '$y-$m-$d $hh:$mm';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user